From 7613681627a78d5994f2b21075f968a4fd50ea95 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 2 Mar 2020 09:18:04 +0100 Subject: [PATCH] Don't try to format deleted shares 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 --- .../lib/Controller/ShareAPIController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 4893be25b2..68729db6de 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -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; }