Skip to content

Commit cdc4dac

Browse files
juliusknorrmax-nextcloud
authored andcommitted
fix: Throw instead of yielding nothing when listing local directories
Signed-off-by: Julius Härtl <jus@bitgrid.net> Signed-off-by: Max <max@nextcloud.com>
1 parent 822e763 commit cdc4dac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/private/Files/Storage/Common.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
use OCP\Files\Storage\ILockingStorage;
6161
use OCP\Files\Storage\IStorage;
6262
use OCP\Files\Storage\IWriteStreamStorage;
63+
use OCP\Files\Storage\StorageNotAvailableException;
6364
use OCP\ILogger;
6465
use OCP\Lock\ILockingProvider;
6566
use OCP\Lock\LockedException;
@@ -877,6 +878,11 @@ public function writeStream(string $path, $stream, int $size = null): int {
877878

878879
public function getDirectoryContent($directory): \Traversable {
879880
$dh = $this->opendir($directory);
881+
882+
if ($dh === false) {
883+
throw new StorageNotAvailableException('Directory listing failed');
884+
}
885+
880886
if (is_resource($dh)) {
881887
$basePath = rtrim($directory, '/');
882888
while (($file = readdir($dh)) !== false) {

0 commit comments

Comments
 (0)