From ce9e5e655fac1cc141dec4757a113687f96efd51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 20 Nov 2023 14:26:12 +0100 Subject: [PATCH] fix: Also cleanup orphaned shares user cannot be found anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/lib/OrphanHelper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/OrphanHelper.php b/apps/files_sharing/lib/OrphanHelper.php index 6d15680f882d8..e4fd062db3b20 100644 --- a/apps/files_sharing/lib/OrphanHelper.php +++ b/apps/files_sharing/lib/OrphanHelper.php @@ -23,6 +23,7 @@ namespace OCA\Files_Sharing; +use OC\User\NoUserException; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\IRootFolder; use OCP\IDBConnection; @@ -40,7 +41,11 @@ public function __construct( } public function isShareValid(string $owner, int $fileId): bool { - $userFolder = $this->rootFolder->getUserFolder($owner); + try { + $userFolder = $this->rootFolder->getUserFolder($owner); + } catch (NoUserException $e) { + return false; + } $nodes = $userFolder->getById($fileId); return count($nodes) > 0; }