From 22eab7ba366cc7d0f4debbc957105ac00bbcd8ba Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Fri, 23 Feb 2024 16:07:43 +0100 Subject: fix: Throw instead of yielding nothing when listing local directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/Storage/Common.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/private/Files') diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 65c2580e61c..830f0aaded7 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -62,6 +62,7 @@ use OCP\Files\ReservedWordException; use OCP\Files\Storage\ILockingStorage; use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IWriteStreamStorage; +use OCP\Files\StorageNotAvailableException; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; use OCP\Server; @@ -898,6 +899,11 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { public function getDirectoryContent($directory): \Traversable { $dh = $this->opendir($directory); + + if ($dh === false) { + throw new StorageNotAvailableException('Directory listing failed'); + } + if (is_resource($dh)) { $basePath = rtrim($directory, '/'); while (($file = readdir($dh)) !== false) { -- cgit v1.2.3 From ac7f3ee985ad2c2d229411dabe48e19162131b67 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 29 Nov 2023 16:34:19 +0100 Subject: add a debug option to force a full filesystem setup Signed-off-by: Robin Appelman --- lib/private/Files/SetupManager.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/private/Files') diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 511e80bd7d9..93b7dc37b6b 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -80,6 +80,7 @@ class SetupManager { private bool $listeningForProviders; private array $fullSetupRequired = []; private bool $setupBuiltinWrappersDone = false; + private bool $forceFullSetup = false; public function __construct( private IEventLogger $eventLogger, @@ -97,6 +98,7 @@ class SetupManager { ) { $this->cache = $cacheFactory->createDistributed('setupmanager::'); $this->listeningForProviders = false; + $this->forceFullSetup = $this->config->getSystemValueBool('debug.force-full-fs-setup'); $this->setupListeners(); } @@ -470,6 +472,10 @@ class SetupManager { } private function fullSetupRequired(IUser $user): bool { + if ($this->forceFullSetup) { + return true; + } + // we perform a "cached" setup only after having done the full setup recently // this is also used to trigger a full setup after handling events that are likely // to change the available mounts -- cgit v1.2.3