fix: Throw instead of yielding nothing when listing local directories

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/43787/head
Julius Härtl 2 years ago
parent 3814ef6d06
commit 22eab7ba36
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
  1. 6
      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) {

Loading…
Cancel
Save