From ae3c20e0f101aa4ef30a1683a94450275aced5c3 Mon Sep 17 00:00:00 2001 From: schklom <23263086+schklom@users.noreply.github.com> Date: Wed, 16 Mar 2022 16:27:20 +0100 Subject: [PATCH] Skip folders which contain a .nomedia or .noimage file --- lib/Service/PhotofilesService.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Service/PhotofilesService.php b/lib/Service/PhotofilesService.php index 3f47a9ec7..34255731b 100644 --- a/lib/Service/PhotofilesService.php +++ b/lib/Service/PhotofilesService.php @@ -331,6 +331,17 @@ private function gatherPhotoFiles ($folder, $recursive) { continue; } } + // we don't explore folders which contain .nomedia or .noimage + $stop = false; + $insideNodes = $node->getDirectoryListing(); + foreach ($insideNodes as $insideNode) { + if ($insideNode->getType() !== FileInfo::TYPE_FOLDER) { + if ($insideNode->getName() === ".nomedia" || $insideNode->getName() === ".noimage") { + $stop = true; + break; + } + } + } try { $notes = array_merge($notes, $this->gatherPhotoFiles($node, $recursive)); } catch (\OCP\Files\StorageNotAvailableException | \Exception $e) {