Skip to content

Commit 5f63e56

Browse files
committed
fix: make sure all mounts are setup in getById
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent afe3bf6 commit 5f63e56

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lib/private/Files/Node/Root.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use OCP\Cache\CappedMemoryCache;
2020
use OCP\EventDispatcher\IEventDispatcher;
2121
use OCP\Files\Cache\ICacheEntry;
22+
use OCP\Files\Config\ICachedMountInfo;
2223
use OCP\Files\Config\IUserMountCache;
2324
use OCP\Files\Events\Node\FilesystemTornDownEvent;
2425
use OCP\Files\IRootFolder;
@@ -405,6 +406,7 @@ public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
405406
*/
406407
public function getByIdInPath(int $id, string $path): array {
407408
$mountCache = $this->getUserMountCache();
409+
$setupManager = $this->mountManager->getSetupManager();
408410
if ($path !== '' && strpos($path, '/', 1) > 0) {
409411
[, $user] = explode('/', $path);
410412
} else {
@@ -414,7 +416,7 @@ public function getByIdInPath(int $id, string $path): array {
414416

415417
// if the mount isn't in the cache yet, perform a setup first, then try again
416418
if (count($mountsContainingFile) === 0) {
417-
$this->mountManager->getSetupManager()->setupForPath($path, true);
419+
$setupManager->setupForPath($path, true);
418420
$mountsContainingFile = $mountCache->getMountsForFileId($id, $user);
419421
}
420422

@@ -436,11 +438,7 @@ public function getByIdInPath(int $id, string $path): array {
436438
}, $mountsContainingFile));
437439
$mountRoots = array_combine($mountRootIds, $mountRootPaths);
438440

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

445443
if (count($mountsContainingFile) === 0) {
446444
if ($user === $this->getAppDataDirectoryName()) {

0 commit comments

Comments
 (0)