Skip to content

Commit

Permalink
fix: Get file from share link instead of user directory in case of no…
Browse files Browse the repository at this point in the history
… access

If a user opens a public share link but does not have access to the file
in question on their filesystem, text failed to render the public share
link as we always tried to get the file directly.

Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Nov 20, 2023
1 parent d8053af commit 5173c01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5173c01

Please sign in to comment.