From f2504821b6402ca16d2f00bec3bd9aaffcfca64a Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Wed, 13 Dec 2023 09:54:11 +0100 Subject: [PATCH] Fix NoUserException Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/Versions/VersionsBackend.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Versions/VersionsBackend.php b/lib/Versions/VersionsBackend.php index 1de84094e..e3234bd05 100644 --- a/lib/Versions/VersionsBackend.php +++ b/lib/Versions/VersionsBackend.php @@ -70,7 +70,11 @@ public function getVersionsForFile(IUser $user, FileInfo $file): array { /** @var Folder $versionsFolder */ $versionsFolder = $this->getVersionsFolder($mount->getFolderId())->get((string)$file->getId()); - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + try { + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + } catch (NoUserException $e) { + return []; + } $nodes = $userFolder->getById($file->getId()); $node = array_pop($nodes); @@ -127,7 +131,12 @@ public function getVersionsForFile(IUser $user, FileInfo $file): array { * @return IVersion[] */ private function getVersionsForFileFromDB(FileInfo $file, IUser $user, int $folderId): array { - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + try { + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + } catch (NoUserException $e) { + return []; + } + /** @var Folder $versionsFolder */ $versionsFolder = $this->getVersionsFolder($folderId)->get((string)$file->getId());