fs: fix crash with .nomedia folder (fix #589)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/602/head
Varun Patil 2023-04-19 09:47:57 -07:00
parent f268943e5e
commit 52e1901ffc
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,7 @@ use OCA\Memories\Util;
use OCP\Files\File; use OCP\Files\File;
use OCP\Files\Folder; use OCP\Files\Folder;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\Search\ISearchComparison; use OCP\Files\Search\ISearchComparison;
use OCP\ICache; use OCP\ICache;
use OCP\ICacheFactory; use OCP\ICacheFactory;
@ -154,7 +155,7 @@ class FsManager
$comp = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', '.nomedia'); $comp = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', '.nomedia');
$search = $root->search(new SearchQuery($comp, 0, 0, [], Util::getUser())); $search = $root->search(new SearchQuery($comp, 0, 0, [], Util::getUser()));
$paths = array_map(fn (File $node) => \dirname($node->getPath()), $search); $paths = array_map(fn (Node $node) => \dirname($node->getPath()), $search);
$this->nomediaCache->set($key, $paths, 60 * 60); // 1 hour $this->nomediaCache->set($key, $paths, 60 * 60); // 1 hour
return $paths; return $paths;