Skip to content

Commit

Permalink
fix note creation on encrypted s3 storage
Browse files Browse the repository at this point in the history
  • Loading branch information
korelstar committed Mar 5, 2021
1 parent 23168c5 commit 6001c37
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion lib/Controller/NotesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public function get(int $id) : JSONResponse {
public function create(string $category) : JSONResponse {
return $this->helper->handleErrorResponse(function () use ($category) {
$note = $this->notesService->create($this->helper->getUID(), '', $category);
$note->setContent('');
return $note->getData();
});
}
Expand Down
12 changes: 0 additions & 12 deletions lib/Service/NotesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,6 @@ public function create(string $userId, string $title, string $category) : Note {
// create file
$file = $folder->newFile($filename);

// try to write some content
try {
// If server-side encryption is activated, the server creates an empty file without signature
// which leads to an GenericEncryptionException('Missing Signature') afterwards.
// Saving a space-char (and removing it later) is a working work-around.
$file->putContent(' ');
} catch (\Throwable $e) {
// if writing the content fails, we have to roll back the note creation
$this->delete($userId, $file->getId());
throw $e;
}

return new Note($file, $notesFolder, $this->noteUtil);
}

Expand Down

0 comments on commit 6001c37

Please sign in to comment.