mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
fix: add some extra checks for getMountsForPath arguments
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
83ac1c6030
commit
53b160ce9b
2 changed files with 12 additions and 7 deletions
|
|
@ -84,9 +84,12 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param MountProviderArgs[] $mountProviderArgs
|
||||
* @return array<string, IMountPoint> 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> $mountProviderArgs
|
||||
* @return array<string, IMountPoint> 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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue