mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 01:28:08 -04:00
fix: don't skip scanner users filesystem if they have a mountpoint at /<user>/files/
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
d5b6ce43a9
commit
54a1ca0da0
1 changed files with 7 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -210,6 +212,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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue