From cf851a390157c55f63276c9b35de50a84d819325 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 10 Apr 2025 16:58:23 +0200 Subject: [PATCH] fix: handle shares for which the source is deleted when checking if rename target is shared Signed-off-by: Robin Appelman --- lib/private/Files/View.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index bbad24d3e435f..f6ca2b09d0f0f 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1893,12 +1893,16 @@ private function targetIsNotShared(string $user, string $targetPath): bool { }, $providers)); foreach ($shares as $share) { - $sharedPath = $share->getNode()->getPath(); - if ($targetPath === $sharedPath || str_starts_with($targetPath, $sharedPath . '/')) { - $this->logger->debug( - 'It is not allowed to move one mount point into a shared folder', - ['app' => 'files']); - return false; + try { + $sharedPath = $share->getNode()->getPath(); + if ($targetPath === $sharedPath || str_starts_with($targetPath, $sharedPath . '/')) { + $this->logger->debug( + 'It is not allowed to move one mount point into a shared folder', + ['app' => 'files']); + return false; + } + } catch (NotFoundException $e) { + // ignore } }