From 809d638c05d95e22a3e37f92a280edf64753f31f Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Mon, 27 Jan 2025 15:49:22 +0100 Subject: [PATCH] fix: make early check if users filesystem have a mountpoint at //files/ Signed-off-by: Maksim Sukharev --- lib/private/Files/Utils/Scanner.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index e9ed351b27bcd..576cb66b3cf9f 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -205,7 +205,10 @@ public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECUR foreach (['', 'files'] as $path) { if (!$storage->isCreatable($path)) { $fullPath = $storage->getSourcePath($path); - if (!$storage->is_dir($path) && $storage->getCache()->inCache($path)) { + if (isset($mounts[$mount->getMountPoint() . $path . '/'])) { + // //files is overwritten by a mountpoint, so this check is irrelevant + break; + } elseif (!$storage->is_dir($path) && $storage->getCache()->inCache($path)) { throw new NotFoundException("User folder $fullPath exists in cache but not on disk"); } elseif ($storage->is_dir($path)) { $ownerUid = fileowner($fullPath); @@ -213,9 +216,6 @@ public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECUR $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 . '/'])) { - // //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;