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>
This commit is contained in:
Julius Härtl 2024-02-23 16:07:43 +01:00 committed by Max
parent 4f827d549d
commit b65c8c2cea
No known key found for this signature in database
GPG key ID: 0F5BFA367A00BACE

View file

@ -60,6 +60,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\ILogger;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
@ -877,6 +878,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) {