diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index 446027a96f1..364ab003125 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -84,9 +84,12 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { } /** - * @param MountProviderArgs[] $mountProviderArgs - * @return array IMountPoint array indexed by mount - * point. + * The caller is responsible to ensure that all provided MountProviderArgs + * are for the same user. + * And that the `$providerClass` implements IPartialMountProvider. + * + * @param list $mountProviderArgs + * @return array IMountPoint array indexed by mount point. */ public function getUserMountsFromProviderByPath( string $providerClass, @@ -98,14 +101,16 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { if ($provider === null) { return []; } + if (count($mountProviderArgs) === 0) { + return []; + } - if (!is_a($providerClass, IPartialMountProvider::class, true)) { + if (!$provider instanceof IPartialMountProvider) { throw new \LogicException( 'Mount provider does not support partial mounts' ); } - /** @var IPartialMountProvider $provider */ return $provider->getMountsForPath( $path, $forChildren, diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index cefd5fac924..c95995565f2 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -600,7 +600,7 @@ class SetupManager { } $this->setupMountProviderPaths[$mountPoint] = self::SETUP_WITH_CHILDREN; foreach ($authoritativeCachedMounts as $providerClass => $cachedMounts) { - $providerArgs = array_filter(array_map( + $providerArgs = array_values(array_filter(array_map( static function (ICachedMountInfo $info) use ($rootsMetadata) { $rootMetadata = $rootsMetadata[$info->getRootId()] ?? null; @@ -609,7 +609,7 @@ class SetupManager { : null; }, $cachedMounts - )); + ))); $authoritativeMounts[] = $this->mountProviderCollection->getUserMountsFromProviderByPath( $providerClass, $path,