-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Exclude Directories #19235
Exclude Directories #19235
Conversation
@@ -61,6 +61,15 @@ | |||
exit(); | |||
} | |||
|
|||
if (\OC\Files\Filesystem::isForbiddenFileOrDir($fileName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the hook catch this already?
https://github.com/owncloud/core/pull/19235/files#diff-73d71f74c9f6d7093f369006c0c60dfeR585
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it does not.
And we need this query here to display on the UI the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's about "upload" then? There you also get a generic error message only, right?
Maybe it would be a good idea to let the hook throw an exception with the corresponding error message if it is forbidden and then make sure that we display the error message from the exception instead of a generic one. You could use the HintException to provide a translated message. We do something similar with encryption errors.
It is probably more failure save instead of adding if statements all over the place and it is more generic since other errors can be handled the same way.
89e0238
to
7a0268b
Compare
Testscenario_1:
(1) ... A browser popup should appear that this name is excluded and can´t be used
Testscenario_2:
Testscenario_3:
(1) ... A Fatal Error Message is created, the WebDav client also shows an error. But this is according to my tests not related to this PR. For details pls see #19101 (WebDav: create directory with an already existing directory name -> Fatal error)
Note : I wanted to use checkboxes in the table, but this did not work |
Excellent, thank you :) |
@DeepDiver1975 @oparoz I don't think we want this in 8.2. We are already in feature freeze. |
I don't have a say in this ;) |
@DeepDiver1975 @cmonteroluque enhancement -> 9.0 |
@MorrisJobke ok |
7a0268b
to
b5b954b
Compare
rebased |
@icewind1991 can you please comment on this PR ? |
needs rebase |
Please also ping in owncloud-archive/documentation#1275 if this PR gets merged. |
Rebased, not tested yet (files app still seems to work at the moment) |
unit tests are badly falling apart - 89 failed tests |
@@ -1408,6 +1408,9 @@ public function getDirectoryContent($directory, $mimetype_filter = '') { | |||
/** | |||
* @var \OC\Files\FileInfo[] $files | |||
*/ | |||
$files = array_filter(function(ICacheEntry $content) { | |||
return (!\OC\Files\Filesystem::isForbiddenFileOrDir($content['path'])); | |||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should´nt that be (without testing):
$files = array_filter($content, function(ICacheEntry $c) {
return (!\OC\Files\Filesystem::isForbiddenFileOrDir($c['path']));
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, fixed
Did a quick test with the old Webdav and new Webdav endpoints and an excluded folder called "snapshots". Seems to work so far: listing, deleting or overwriting the folder is denied. |
Great ! |
No time to kill on the plane ? (if applicable) 😉 Am thinking of maybe writing integration tests to automatically test this. |
extended case: search at any place of the path given adding case insensitiveness added suggestions and improvements removed unnecessary function parameter new approach according the rethinking fixed code and unit tests update comments improved code, added calls for trashbin copyFromStorage
extended case: search at any place of the path given adding case insensitiveness added suggestions and improvements removed unnecessary function parameter new approach according the rethinking fixed code and unit tests update comments improved code, added calls for trashbin copyFromStorage
f8cd27a
to
b234170
Compare
@PVince81 any news? would really appreciate to get that in |
Tested with many file operations on local storage and external storage and also subdirectories. Exclusion works fine 👍 |
|
@mmattel thanks a lot ! And sorry that it took so long to get in. |
🎉 😃 |
… Storage use) owncloud/core/pull/19235 Adds the ability to define directories in config.php which will not be further processed (scanned, shown, created ect). These directories exist but will not handled in nextcloud. Usecase: eg. filesystem which have the ability of snapshots have a defined naming for them. For details pls see also the documentation PR coming asap.
@PVince81 is this safe to patch into current 9.1 ? |
@kawohl no, this is a huge change and I wouldn't recommend patching. This would need careful testing. |
thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Successor of PR #16534
Before mmattel/core
Now owncloud/core
Shoud fix CI start