diff options
Diffstat (limited to 'lib/private/Files/Config/UserMountCache.php')
-rw-r--r-- | lib/private/Files/Config/UserMountCache.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index 6c64dc4973f..8275eee7b9f 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -251,6 +251,9 @@ class UserMountCache implements IUserMountCache { */ public function getMountsForUser(IUser $user) { $userUID = $user->getUID(); + if (!$this->userManager->userExists($userUID)) { + return []; + } if (!isset($this->mountsForUsers[$userUID])) { $builder = $this->connection->getQueryBuilder(); $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'mount_provider_class') @@ -370,14 +373,18 @@ class UserMountCache implements IUserMountCache { } $mountsForStorage = $this->getMountsForStorageId($storageId, $user); - // filter mounts that are from the same storage but a different directory + // filter mounts that are from the same storage but not a parent of the file we care about $filteredMounts = array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) { if ($fileId === $mount->getRootId()) { return true; } $internalMountPath = $mount->getRootInternalPath(); - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; + return $internalMountPath === '' || str_starts_with($internalPath, $internalMountPath . '/'); + }); + + $filteredMounts = array_filter($filteredMounts, function (ICachedMountInfo $mount) { + return $this->userManager->userExists($mount->getUser()->getUID()); }); return array_map(function (ICachedMountInfo $mount) use ($internalPath) { |