Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't skip scanner users filesystem if they have a mountpoint at /<user>/files/ #49887

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/private/Files/Utils/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct($user, $db, IEventDispatcher $dispatcher, LoggerInte
* get all storages for $dir
*
* @param string $dir
* @return \OC\Files\Mount\MountPoint[]
* @return array<string, \OC\Files\Mount\MountPoint>
*/
protected function getMounts($dir) {
//TODO: move to the node based fileapi once that's done
Expand All @@ -96,8 +96,9 @@ protected function getMounts($dir) {
$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);
}

/**
Expand Down Expand Up @@ -210,6 +211,9 @@ 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 . '/'])) {
// /<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;
Expand Down
Loading