Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request : Regex for blacklisted files #11737

Closed
kevin88000 opened this issue Oct 10, 2018 · 3 comments
Closed

Feature request : Regex for blacklisted files #11737

kevin88000 opened this issue Oct 10, 2018 · 3 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: caching Related to our caching system: scssCacher, jsCombiner... feature: dav needs info stale Ticket or PR with no recent activity

Comments

@kevin88000
Copy link

kevin88000 commented Oct 10, 2018

It would be great to have the possibility to use regex for blacklisted files.

Here a small patch (that maybe need to be completed) to allow to define a setting "blacklisted_files_regex" in config.php :

--- ../cloud.save/lib/private/Files/Filesystem.php      2018-10-10 11:27:27.361289181 +0200
+++ lib/private/Files/Filesystem.php    2018-10-10 11:51:31.652656763 +0200
@@ -619,7 +619,20 @@

                $blacklist = \OC::$server->getConfig()->getSystemValue('blacklisted_files', array('.htaccess'));
                $filename = strtolower(basename($filename));
-               return in_array($filename, $blacklist);
+
+               if (in_array($filename, $blacklist))
+                       return true;
+
+               $blacklist_regex =  \OC::$server->getConfig()->getSystemValue('blacklisted_files_regex', array());
+
+               if (is_array($blacklist_regex)) {
+                       foreach ($blacklist_regex as $regex) {
+                               if (preg_match('#' . $regex . '#', $filename)) {
+                                       return true;
+                               }
+                       }
+               }
+               return false;
        }

        /**
@nextcloud-bot nextcloud-bot added the feature: caching Related to our caching system: scssCacher, jsCombiner... label Oct 10, 2018
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #9182 (Just a question // Feature request // Pretty Share URL), #11322 (Progress bar for file copy/move [feature request]), #3985 (feature request: multi tennancy (or is it already possible)), #6215 ([Feature Req] Move multiple selected files), and #7616 (Feature request: Sync existing).

@szaimen
Copy link
Contributor

szaimen commented Jun 9, 2021

Hi @kevin88000 would you be able to create a PR with the mentioned code? Thanks! :)

@ghost
Copy link

ghost commented Jul 9, 2021

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

@ghost ghost added the stale Ticket or PR with no recent activity label Jul 9, 2021
@ghost ghost closed this as completed Jul 23, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: caching Related to our caching system: scssCacher, jsCombiner... feature: dav needs info stale Ticket or PR with no recent activity
Projects
None yet
Development

No branches or pull requests

4 participants