diff --git a/README.md b/README.md
index 96ded46ff..604385fa9 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Gallery
+# Gallery
[](https://travis-ci.org/nextcloud/gallery)
[](https://scrutinizer-ci.com/g/nextcloud/gallery/?branch=master)
[](https://codecov.io/gh/nextcloud/gallery)
@@ -20,7 +20,7 @@ Provides a dedicated view of all images in a grid, adds image viewing capabiliti
* A la carte features (external shares, browser svg rendering, etc.)
* Image download and sharing straight from the slideshow or the gallery
* Switch to Gallery from any folder in files and vice-versa
-* Ignore folders containing a ".nomedia" file
+* Ignore folders containing a ".nomedia" or ".noimage" file
* Browser rendering of SVG images (disabled by default)
* Mobile support
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 21b3d3a98..1aac1065e 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -22,7 +22,7 @@
- Switch to Gallery from any folder in files and vice-versa
- - Ignore folders containing a ".nomedia" file
+ - Ignore folders containing a ".nomedia" or ".noimage" file
- Browser rendering of SVG images (disabled by default)
@@ -55,4 +55,3 @@
https://github.com/nextcloud/gallery/wiki
-
diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php
index 4ec2b6251..429bfd748 100644
--- a/lib/Service/ConfigService.php
+++ b/lib/Service/ConfigService.php
@@ -159,7 +159,7 @@ public function getSupportedMediaTypes($extraMediaTypes, $nativeSvgSupport) {
public function getConfig($folderNode, $features) {
$this->features = $features;
list ($albumConfig, $ignored) =
- $this->collectConfig($folderNode, $this->ignoreAlbum, $this->configName);
+ $this->collectConfig($folderNode, $this->ignoreAlbumStrings, $this->configName);
if ($ignored) {
throw new ForbiddenServiceException(
'The owner has placed a restriction or the storage location is unavailable'
@@ -238,7 +238,7 @@ private function isMimeSupported($mimeType = '*') {
* reached the root folder
*
* @param Folder $folder the current folder
- * @param string $ignoreAlbum name of the file which blacklists folders
+ * @param array $ignoreAlbumStrings names of the files which blacklist folders
* @param string $configName name of the configuration file
* @param int $level the starting level is 0 and we add 1 each time we visit a parent folder
* @param array $configSoFar the configuration collected so far
@@ -246,18 +246,20 @@ private function isMimeSupported($mimeType = '*') {
* @return array
*/
private function collectConfig(
- $folder, $ignoreAlbum, $configName, $level = 0, $configSoFar = []
+ $folder, $ignoreAlbumStrings, $configName, $level = 0, $configSoFar = []
) {
- if ($folder->nodeExists($ignoreAlbum)) {
- // Cancel as soon as we find out that the folder is private or external
- return [null, true];
+ foreach ($ignoreAlbumStrings as $ignoreAlbum) {
+ if ($folder->nodeExists($ignoreAlbum)) {
+ // Cancel as soon as we find out that the folder is private or external
+ return [null, true];
+ }
}
$isRootFolder = $this->isRootFolder($folder, $level);
if ($folder->nodeExists($configName)) {
$configSoFar = $this->buildFolderConfig($folder, $configName, $configSoFar, $level);
}
if (!$isRootFolder) {
- return $this->getParentConfig($folder, $ignoreAlbum, $configName, $level, $configSoFar);
+ return $this->getParentConfig($folder, $ignoreAlbumStrings, $configName, $level, $configSoFar);
}
$configSoFar = $this->validatesInfoConfig($configSoFar);
@@ -345,7 +347,7 @@ private function validatesInfoConfig($albumConfig) {
* We will look up to the virtual root of a shared folder, for privacy reasons
*
* @param Folder $folder the current folder
- * @param string $privacyChecker name of the file which blacklists folders
+ * @param string $privacyChecker names of the files which blacklist folders
* @param string $configName name of the configuration file
* @param int $level the starting level is 0 and we add 1 each time we visit a parent folder
* @param array $collectedConfig the configuration collected so far
diff --git a/lib/Service/FilesService.php b/lib/Service/FilesService.php
index e88ebe520..6c843fef2 100644
--- a/lib/Service/FilesService.php
+++ b/lib/Service/FilesService.php
@@ -28,8 +28,8 @@ abstract class FilesService extends Service {
protected $virtualRootLevel = null;
/** @var string[] */
protected $features;
- /** @var string */
- protected $ignoreAlbum = '.nomedia';
+ /** @var string[] */
+ protected $ignoreAlbumStrings = ['.nomedia', '.noimage'];
/**
* Retrieves all files and sub-folders contained in a folder
@@ -144,9 +144,12 @@ protected function getAllowedSubFolder($node, $nodeType) {
if ($nodeType === 'dir') {
/** @var Folder $node */
try {
- if (!$node->nodeExists($this->ignoreAlbum)) {
- return [$node];
+ foreach ($this->ignoreAlbumStrings as $ignoreAlbum) {
+ if ($node->nodeExists($ignoreAlbum)) {
+ return [];
+ }
}
+ return [$node];
} catch (StorageNotAvailableException $e) {
return [];
}