diff options
author | Robin Appelman <robin@icewind.nl> | 2024-12-16 20:31:14 +0100 |
---|---|---|
committer | Maksim Sukharev <antreesy.web@gmail.com> | 2025-01-10 16:21:59 +0100 |
commit | 85af1b471588ae8d3a7228816e94127555351fb1 (patch) | |
tree | 606be42332e2fbd85b2bc4cc6dca215243ea5d06 | |
parent | d1507f641dc9973c1caaea5efff10c59ffebff0f (diff) | |
download | nextcloud-server-85af1b471588ae8d3a7228816e94127555351fb1.tar.gz nextcloud-server-85af1b471588ae8d3a7228816e94127555351fb1.zip |
fix: don't skip scanner users filesystem if they have a mountpoint at /<user>/files/
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/Utils/Scanner.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index bcc54dea0dc..0c0fe7a0ebf 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -23,6 +23,7 @@ use OCP\Files\Events\FileScannedEvent; use OCP\Files\Events\FolderScannedEvent; use OCP\Files\Events\NodeAddedToCache; use OCP\Files\Events\NodeRemovedFromCache; +use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\Files\Storage\IStorage; use OCP\Files\StorageNotAvailableException; @@ -85,7 +86,7 @@ class Scanner extends PublicEmitter { * get all storages for $dir * * @param string $dir - * @return \OC\Files\Mount\MountPoint[] + * @return array<string, IMountPoint> */ protected function getMounts($dir) { //TODO: move to the node based fileapi once that's done @@ -96,8 +97,9 @@ class Scanner extends PublicEmitter { $mounts = $mountManager->findIn($dir); $mounts[] = $mountManager->find($dir); $mounts = array_reverse($mounts); //start with the mount of $dir + $mountPoints = array_map(fn ($mount) => $mount->getMountPoint(), $mounts); - return $mounts; + return array_combine($mountPoints, $mounts); } /** @@ -208,6 +210,9 @@ class Scanner extends PublicEmitter { $owner = $owner['name'] ?? $ownerUid; $permissions = decoct(fileperms($fullPath)); throw new ForbiddenException("User folder $fullPath is not writable, folders is owned by $owner and has mode $permissions"); + } elseif (isset($mounts[$mount->getMountPoint() . $path . '/'])) { + // /<user>/files is overwritten by a mountpoint, so this check is irrelevant + break; } else { // if the root exists in neither the cache nor the storage the user isn't setup yet break 2; |