Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Types of changes:
## [Unreleased]


## 3.1.4 - 2020-02-06

### Fixed
- fix regression for v3.1.3 (#459)


## 3.1.3 - 2020-02-05

### Changed
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<description><![CDATA[
The Notes app is a distraction free notes taking app. It provides categories for better organization and supports formatting using [Markdown](https://en.wikipedia.org/wiki/Markdown) syntax. Notes are saved as files in your Nextcloud, so you can view and edit them with every Nextcloud client. Furthermore, a separate [RESTful API](https://github.com/nextcloud/notes/wiki/API-0.2) allows for an easy integration into third-party apps (currently, there are notes apps for [Android](https://github.com/stefan-niedermann/nextcloud-notes) and [iOS](https://github.com/owncloud/notes-iOS-App) which allow convenient access to your Nextcloud notes). Further features include marking notes as favorites.
]]></description>
<version>3.1.3</version>
<version>3.1.4</version>
<licence>agpl</licence>
<author>Kristof Hamann</author>
<author>Bernhard Posselt</author>
Expand Down
3 changes: 1 addition & 2 deletions lib/Service/NoteUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ public function deleteEmptyFolder(Folder $notesFolder, Folder $folder) {
* @param File file that needs storage
* @throws InsufficientStorageException
*/
public function ensureSufficientStorage(File $file, $requiredBytes) : void {
$folder = $file->getParent();
public function ensureSufficientStorage(Folder $folder, $requiredBytes) : void {
$availableBytes = $folder->getFreeSpace();
if ($availableBytes >= 0 && $availableBytes < $requiredBytes) {
$this->logger->error('Insufficient storage in '.$folder->getPath().': available are '.$availableBytes.'; required are '.$requiredBytes, ['app' => $this->appName]);
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/NotesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function getNote(File $file, Folder $notesFolder, $tags = [], $onlyMeta
public function create($userId) : Note {
$title = $this->l10n->t('New note');
$folder = $this->getFolderForUser($userId);
$this->noteUtil->ensureSufficientStorage($file, 1);
$this->noteUtil->ensureSufficientStorage($folder, 1);

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

if ($content !== null) {
$this->noteUtil->ensureSufficientStorage($file, strlen($content));
$this->noteUtil->ensureSufficientStorage($file->getParent(), strlen($content));
$file->putContent($content);
}

Expand Down