Skip to content

Commit c8b6398

Browse files
committed
fix: don't skip scanner users filesystem if they have a mountpoint at /<user>/files/
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 53c9cda commit c8b6398

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/private/Files/Utils/Scanner.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct($user, $db, IEventDispatcher $dispatcher, LoggerInte
8585
* get all storages for $dir
8686
*
8787
* @param string $dir
88-
* @return \OC\Files\Mount\MountPoint[]
88+
* @return array<string, \OC\Files\Mount\MountPoint>
8989
*/
9090
protected function getMounts($dir) {
9191
//TODO: move to the node based fileapi once that's done
@@ -96,8 +96,9 @@ protected function getMounts($dir) {
9696
$mounts = $mountManager->findIn($dir);
9797
$mounts[] = $mountManager->find($dir);
9898
$mounts = array_reverse($mounts); //start with the mount of $dir
99+
$mountPoints = array_map(fn ($mount) => $mount->getMountPoint(), $mounts);
99100

100-
return $mounts;
101+
return array_combine($mountPoints, $mounts);
101102
}
102103

103104
/**
@@ -210,6 +211,9 @@ public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECUR
210211
$owner = $owner['name'] ?? $ownerUid;
211212
$permissions = decoct(fileperms($fullPath));
212213
throw new ForbiddenException("User folder $fullPath is not writable, folders is owned by $owner and has mode $permissions");
214+
} elseif (isset($mounts[$mount->getMountPoint() . $path . '/'])) {
215+
// /<user>/files is overwritten by a mountpoint, so this check is irrelevant
216+
break;
213217
} else {
214218
// if the root exists in neither the cache nor the storage the user isn't setup yet
215219
break 2;

0 commit comments

Comments
 (0)