Skip to content

Commit ae0c613

Browse files
committed
fix: track already set up paths to avoid loops
Signed-off-by: Salvatore Martire <[email protected]>
1 parent f132d45 commit ae0c613

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/private/Files/SetupManager.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ class SetupManager {
7272
* @var array<string, class-string<IMountProvider>[]>
7373
*/
7474
private array $setupUserMountProviders = [];
75+
/**
76+
* An array of paths that have already been set up
77+
*
78+
* @var array<string, class-string<IMountProvider>[]>
79+
*/
80+
private array $setupMountProviderPaths = [];
7581
private ICache $cache;
7682
private bool $listeningForProviders;
7783
private array $fullSetupRequired = [];
@@ -512,7 +518,7 @@ public function setupForPathAuthoritative(string $path, bool $includeChildren =
512518
return;
513519
}
514520

515-
if ($this->isSetupComplete($user)) {
521+
if ($this->isSetupComplete($user) || isset($this->setupMountProviderPaths[$path])) {
516522
return;
517523
}
518524

@@ -633,6 +639,7 @@ public function tearDown() {
633639
$this->setupUsers = [];
634640
$this->setupUsersComplete = [];
635641
$this->setupUserMountProviders = [];
642+
$this->setupMountProviderPaths = [];
636643
$this->fullSetupRequired = [];
637644
$this->rootSetup = false;
638645
$this->mountManager->clear();
@@ -724,6 +731,10 @@ public function getMountsFromProviders(
724731
}
725732

726733
if (is_a($providerClass, IPartialMountProvider::class, true)) {
734+
if (isset($this->setupMountProviderPaths[$path])) {
735+
continue; // skip already set up paths
736+
}
737+
$this->setupMountProviderPaths[$path] = true;
727738
// mount provider capable of returning mount-points specific to
728739
// this path
729740
$mounts[] = $this->mountProviderCollection

0 commit comments

Comments
 (0)