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

Catch NotFoundException when querying quota #25313

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

PVince81
Copy link
Member

Fixes parent folder that becomes inaccessible when it contains a
non-existing / broken entry because the quota check made the PROPFIND
on parent fail altogether.

Steps to reproduce

  1. Create a folder "test/regular"
  2. Create a folder "test/broken"
  3. Patch Filesystem::isValidPath and make it return false in case it detects the word "broken" (to simulate non-existence), see patch below
  4. Try accessing the "test" and then "regular" folder in web UI

Before the fix

Error that "test" folder cannot be accessed. This also makes "test/regular" inaccessible.

After the fix

Entering the "test" folder works and "regular" accessible.
The "broken" entry is still there and cannot be entered, but that's ok for now as it's broken. Most important is to not block access to the other working entries.

Patch for reproduction

diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index bf94be273f..d3d83f0b6d 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -587,6 +587,10 @@ class Filesystem {
         * @return bool
         */
        public static function isValidPath($path) {
+               if (stripos($path, 'broken') !== false) {
+                       // simulate broken entry
+                       return false;
+               }
                $path = self::normalizePath($path);
                if (!$path || $path[0] !== '/') {
                        $path = '/' . $path;

@PVince81 PVince81 added bug 3. to review Waiting for reviews labels Jan 25, 2021
@PVince81 PVince81 added this to the Nextcloud 21 milestone Jan 25, 2021
@PVince81 PVince81 self-assigned this Jan 25, 2021
@PVince81
Copy link
Member Author

/backport to stable20

Fixes parent folder that becomes inaccessible when it contains a
non-existing / broken entry because the quota check made the PROPFIND
on parent fail altogether.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81 PVince81 force-pushed the bugfix/noid/harden-unexist-subfolder branch from f9d4584 to 65da8bd Compare January 25, 2021 11:13
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants