diff --git a/lib/Service/NotesService.php b/lib/Service/NotesService.php index 644b61f0c..d191f8c53 100644 --- a/lib/Service/NotesService.php +++ b/lib/Service/NotesService.php @@ -310,7 +310,9 @@ public function getAttachment(string $userId, int $noteid, string $path) : File } } $targetNode = $notesFolder->get(implode('/', $p)); - assert($targetNode instanceof \OCP\Files\File); + if (!($targetNode instanceof File)) { + throw new NoteDoesNotExistException(); + } return $targetNode; }