]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't try to format deleted shares 19731/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Mon, 2 Mar 2020 08:18:04 +0000 (09:18 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 2 Mar 2020 08:18:04 +0000 (09:18 +0100)
Fixes #15455

The issue is that we have a fallback for shares to use the target. So
when the target exists again we happily format it (not that the shares
are still invalid).

This just tries to get the node. If we can't then boom.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
apps/files_sharing/lib/Controller/ShareAPIController.php

index 4893be25b2089be7fe53c2581b27aebb91e3895d..68729db6de85e1f8f297d900a1db0041a96c026b 100644 (file)
@@ -768,6 +768,16 @@ class ShareAPIController extends OCSController {
                $known = $formatted = $miniFormatted = [];
                $resharingRight = false;
                foreach ($shares as $share) {
+                       try {
+                               $share->getNode();
+                       } catch (NotFoundException $e) {
+                               /*
+                                * Ignore shares where we can't get the node
+                                * For example delted shares
+                                */
+                               continue;
+                       }
+
                        if (in_array($share->getId(), $known) || $share->getSharedWith() === $this->currentUser) {
                                continue;
                        }