diff options
author | Robin Appelman <robin@icewind.nl> | 2020-02-25 19:55:15 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-02-25 19:55:15 +0300 |
commit | ecfc59437acc4f0febb914adc435908dde1bc77a (patch) | |
tree | 6765caa1b8f8a9b04013b135c9d6da4eef601d6e /lib | |
parent | 7dd93db7b7a09806f9e6cd20cdd2aa9ff14aa169 (diff) |
ignore unavailable storages while scanning for albums
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/AlbumsController.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Controller/AlbumsController.php b/lib/Controller/AlbumsController.php index 678ea0a7..fa8cfed9 100644 --- a/lib/Controller/AlbumsController.php +++ b/lib/Controller/AlbumsController.php @@ -34,6 +34,7 @@ use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\FIles\Node; use OCP\Files\NotFoundException; +use OCP\Files\StorageNotAvailableException; use OCP\IRequest; class AlbumsController extends Controller { @@ -142,13 +143,17 @@ class AlbumsController extends Controller { return []; } - // Ignore folder with a .noimage or .nomedia node - if ($folder->nodeExists('.noimage') || $folder->nodeExists('.nomedia')) { + try { + // Ignore folder with a .noimage or .nomedia node + if ($folder->nodeExists('.noimage') || $folder->nodeExists('.nomedia')) { + return []; + } + + $nodes = $folder->getDirectoryListing(); + } catch (StorageNotAvailableException $e) { return []; } - $nodes = $folder->getDirectoryListing(); - foreach ($nodes as $node) { if ($node instanceof File) { if ($this->validFile($node, $shared)) { |