Skip to content

Commit 8a5cc33

Browse files
committed
fix: make sure all mounts are setup in getById
Signed-off-by: Robin Appelman <[email protected]>
1 parent afe3bf6 commit 8a5cc33

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/private/Files/Node/Root.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
405405
*/
406406
public function getByIdInPath(int $id, string $path): array {
407407
$mountCache = $this->getUserMountCache();
408+
$setupManager = $this->mountManager->getSetupManager();
408409
if ($path !== '' && strpos($path, '/', 1) > 0) {
409410
[, $user] = explode('/', $path);
410411
} else {
@@ -414,7 +415,7 @@ public function getByIdInPath(int $id, string $path): array {
414415

415416
// if the mount isn't in the cache yet, perform a setup first, then try again
416417
if (count($mountsContainingFile) === 0) {
417-
$this->mountManager->getSetupManager()->setupForPath($path, true);
418+
$setupManager->setupForPath($path, true);
418419
$mountsContainingFile = $mountCache->getMountsForFileId($id, $user);
419420
}
420421

@@ -436,11 +437,7 @@ public function getByIdInPath(int $id, string $path): array {
436437
}, $mountsContainingFile));
437438
$mountRoots = array_combine($mountRootIds, $mountRootPaths);
438439

439-
$mounts = $this->mountManager->getMountsByMountProvider($path, $mountProviders);
440-
441-
$mountsContainingFile = array_filter($mounts, function ($mount) use ($mountRoots) {
442-
return isset($mountRoots[$mount->getStorageRootId()]);
443-
});
440+
$mountsContainingFile = array_filter(array_map($this->mountManager->getMountFromMountInfo(...), $mountsContainingFile));
444441

445442
if (count($mountsContainingFile) === 0) {
446443
if ($user === $this->getAppDataDirectoryName()) {

0 commit comments

Comments
 (0)