Skip to content

Commit

Permalink
fix: Throw instead of yielding nothing when listing local directories
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
juliusknorr authored and max-nextcloud committed Feb 27, 2024
1 parent 822e763 commit df148b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,11 @@ public function writeStream(string $path, $stream, int $size = null): int {

public function getDirectoryContent($directory): \Traversable {
$dh = $this->opendir($directory);

if ($dh === false) {
throw new StorageNotAvailableException('Directory listing failed');

Check failure

Code scanning / Psalm

UndefinedClass Error

Class, interface or enum named OC\Files\Storage\StorageNotAvailableException does not exist

Check failure on line 882 in lib/private/Files/Storage/Common.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedClass

lib/private/Files/Storage/Common.php:882:14: UndefinedClass: Class, interface or enum named OC\Files\Storage\StorageNotAvailableException does not exist (see https://psalm.dev/019)
}

if (is_resource($dh)) {
$basePath = rtrim($directory, '/');
while (($file = readdir($dh)) !== false) {
Expand Down

0 comments on commit df148b4

Please sign in to comment.