Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-06-28 16:42:36 +0300
committerGitHub <noreply@github.com>2019-06-28 16:42:36 +0300
commit0f94c969133174da38ec78e0b526bc38128ae9f4 (patch)
tree239f6f03f4be1fab0414a29b0c399859e9f72c7d
parent3f229456b3e6cef6da0242a7bb59bf17f3773f5e (diff)
parent21beed65fe2db59b821ad3ef8d12ee6232b019bd (diff)
Merge pull request #533 from nextcloud/backport/520/stable16
[stable16] Blacklist using .noimage
-rw-r--r--README.md4
-rw-r--r--appinfo/info.xml3
-rw-r--r--lib/Service/ConfigService.php18
-rw-r--r--lib/Service/FilesService.php11
4 files changed, 20 insertions, 16 deletions
diff --git a/README.md b/README.md
index 96ded46f..604385fa 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Gallery
+# Gallery
[![Build Status](https://travis-ci.org/nextcloud/gallery.svg?branch=master)](https://travis-ci.org/nextcloud/gallery)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nextcloud/gallery/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/gallery/?branch=master)
[![Code Coverage](https://codecov.io/gh/nextcloud/gallery/branch/master/graph/badge.svg)](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 21b3d3a9..1aac1065 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 @@
<developer>https://github.com/nextcloud/gallery/wiki</developer>
</documentation>
</info>
-
diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php
index 4ec2b625..429bfd74 100644
--- a/lib/Service/ConfigService.php
+++ b/lib/Service/ConfigService.php
@@ -159,7 +159,7 @@ class ConfigService extends FilesService {
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 @@ class ConfigService extends FilesService {
* 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 @@ class ConfigService extends FilesService {
* @return array <null|array,bool>
*/
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 @@ class ConfigService extends FilesService {
* 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 e88ebe52..6c843fef 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 @@ abstract class FilesService extends Service {
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 [];
}