From fa7616c01f8fe6a19f7adf88a3763fcc58be7f88 Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Mon, 4 Mar 2019 22:04:38 -0700 Subject: [PATCH] Updated to work with NC15. Fixed wildcard matching. Also added some installation instructions --- README.md | 6 ++++++ appinfo/info.xml | 2 +- lib/Wrapper/Exclude.php | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b04c94..86a230d 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,9 @@ occ config:app:set --value '[".snapshot","anotherfolder", "pattern/*/match"]' fi Any file or folder matching one of the configured rules will not be included in Nextcloud if it exists on the filesystem and any user will be blocked from creating any file or folder matching any of the rules. + +## Installation + +* Clone the repository (or download and uncompress it) into a new subdirectory under your nextcloud/apps directory called files\_excludedirs +* In the files\_excludedirs subdirectory run this command to install it: "composer install" +* Make sure the "Exclude directories" app inside nextcloud has been enabled, and you should be good to go! diff --git a/appinfo/info.xml b/appinfo/info.xml index 0a68d0d..2a4bd39 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -8,7 +8,7 @@ 0.0.1 Files_ExcludeDirs - + diff --git a/lib/Wrapper/Exclude.php b/lib/Wrapper/Exclude.php index 9caeb14..5f5bef4 100644 --- a/lib/Wrapper/Exclude.php +++ b/lib/Wrapper/Exclude.php @@ -56,7 +56,9 @@ private function excludedPath($path) { // glob requires all paths to be absolute so we put /'s in front of them if (strpos($rule, '/') !== false) { $rule = '/' . rtrim($rule, '/'); - return Glob::match('/' . $path, $rule); + if(Glob::match('/' . $path, $rule)) { + return true; + } } else { $parts = explode('/', $path); $rule = '/' . $rule;