From d342c764f2f45ec6bcd026482fc4c8f2242cb132 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 14 Mar 2022 15:08:24 +0100 Subject: don't double setup provider when calling `setupForUser` after `setupForPath` Signed-off-by: Robin Appelman --- lib/private/Files/Config/MountProviderCollection.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/private/Files/Config') diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index efbb54edba5..a3c20bdbfbb 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -104,14 +104,19 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { return $this->getMountsForFromProviders($user, $providers); } - public function addMountForUser(IUser $user, IMountManager $mountManager) { + public function addMountForUser(IUser $user, IMountManager $mountManager, callable $providerFilter = null) { // shared mount provider gets to go last since it needs to know existing files // to check for name collisions $firstMounts = []; - $firstProviders = array_filter($this->providers, function (IMountProvider $provider) { + if ($providerFilter) { + $providers = array_filter($this->providers, $providerFilter); + } else { + $providers = $this->providers; + } + $firstProviders = array_filter($providers, function (IMountProvider $provider) { return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); }); - $lastProviders = array_filter($this->providers, function (IMountProvider $provider) { + $lastProviders = array_filter($providers, function (IMountProvider $provider) { return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); }); foreach ($firstProviders as $provider) { -- cgit v1.2.3