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