From b3f529e64f1d481d857f7593d33748aa40110adc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 5 Jul 2023 16:26:44 +0200 Subject: [PATCH] remove no longer accessible shares Signed-off-by: Robin Appelman --- apps/files_sharing/lib/SharedStorage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 6b605a6eddb3a..f59f128781ca0 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -146,9 +146,7 @@ private function init() { /** @var Node|false $ownerNode */ $ownerNode = current($ownerNodes); if (!$ownerNode) { - $this->storage = new FailedStorage(['exception' => new NotFoundException("File by id $sourceId not found")]); - $this->cache = new FailedCache(); - $this->rootPath = ''; + throw new NotFoundException("File by id $sourceId not found"); } else { $this->nonMaskedStorage = $ownerNode->getStorage(); $this->sourcePath = $ownerNode->getPath(); @@ -163,6 +161,8 @@ private function init() { $this->storage = new FailedStorage(['exception' => $e]); $this->cache = new FailedCache(); $this->rootPath = ''; + $this->logger->error("Share source no longer available, removing share", ['exception' => $e, 'app' => 'files_sharing']); + $this->unshareStorage(); } catch (NoUserException $e) { // sharer user deleted, set FailedStorage $this->storage = new FailedStorage(['exception' => $e]);