Skip to content

Commit b4b6799

Browse files
committed
fix regression for v3.1.3
1 parent 335b311 commit b4b6799

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/Service/NoteUtil.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ public function deleteEmptyFolder(Folder $notesFolder, Folder $folder) {
223223
* @param File file that needs storage
224224
* @throws InsufficientStorageException
225225
*/
226-
public function ensureSufficientStorage(File $file, $requiredBytes) : void {
227-
$folder = $file->getParent();
226+
public function ensureSufficientStorage(Folder $folder, $requiredBytes) : void {
228227
$availableBytes = $folder->getFreeSpace();
229228
if ($availableBytes >= 0 && $availableBytes < $requiredBytes) {
230229
$this->logger->error('Insufficient storage in '.$folder->getPath().': available are '.$availableBytes.'; required are '.$requiredBytes, ['app' => $this->appName]);

lib/Service/NotesService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private function getNote(File $file, Folder $notesFolder, $tags = [], $onlyMeta
126126
public function create($userId) : Note {
127127
$title = $this->l10n->t('New note');
128128
$folder = $this->getFolderForUser($userId);
129-
$this->noteUtil->ensureSufficientStorage($file, 1);
129+
$this->noteUtil->ensureSufficientStorage($folder, 1);
130130

131131
// check new note exists already and we need to number it
132132
// pass -1 because no file has id -1 and that will ensure
@@ -181,7 +181,7 @@ public function update($id, $content, $userId, $category = null, $mtime = 0) : N
181181
}
182182

183183
if ($content !== null) {
184-
$this->noteUtil->ensureSufficientStorage($file, strlen($content));
184+
$this->noteUtil->ensureSufficientStorage($file->getParent(), strlen($content));
185185
$file->putContent($content);
186186
}
187187

0 commit comments

Comments
 (0)