diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index a8fe025b..df5ef947 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -108,7 +108,14 @@ public function getFileFromUri(string $uri): Node { * @throws NoUserException */ public function getFileFromAbsoluteUri(string $uri): Node { - [$root, $userId, $path] = explode('/', trim($uri, '/') . '/', 3); + $user = $this->userSession->getUser(); + if ($user === null) { + throw new SessionNotAvailableException(); + } + + $userId = $user->getUID(); + + [$root, , $path] = explode('/', trim($uri, '/') . '/', 3); if ($root !== 'files') { throw new NotFoundException(); }