diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index 2998112e86c..251b7c667ae 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -436,7 +436,11 @@ public function getAll(): array { */ public function getFileForSession(Session $session, ?string $shareToken = null): File { if (!$session->isGuest()) { - return $this->getFileById($session->getDocumentId(), $session->getUserId()); + try { + return $this->getFileById($session->getDocumentId(), $session->getUserId()); + } catch (NotFoundException) { + // We may still have a user session but on a public share link so move on + } } if ($shareToken === null) {