diff --git a/lib/Service/NotesService.php b/lib/Service/NotesService.php index f2c042c7c..c5b73774d 100644 --- a/lib/Service/NotesService.php +++ b/lib/Service/NotesService.php @@ -316,7 +316,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; }