Skip to content

Commit 2296e52

Browse files
committed
fix: properly remove mount with moved child-shares
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 0ff1b88 commit 2296e52

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/files_sharing/lib/ShareRecipientUpdater.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use OCP\Files\Config\IUserMountCache;
1313
use OCP\Files\Storage\IStorageFactory;
1414
use OCP\IUser;
15+
use OCP\Share\Exceptions\ShareNotFound;
16+
use OCP\Share\IManager;
1517
use OCP\Share\IShare;
1618

1719
class ShareRecipientUpdater {
@@ -22,6 +24,7 @@ public function __construct(
2224
private readonly MountProvider $shareMountProvider,
2325
private readonly ShareTargetValidator $shareTargetValidator,
2426
private readonly IStorageFactory $storageFactory,
27+
private readonly IManager $shareManager,
2528
) {
2629
}
2730

@@ -85,7 +88,12 @@ private function getMountPointFromTarget(IUser $user, string $target): string {
8588
* Process a single deleted share for a user
8689
*/
8790
public function updateForDeletedShare(IUser $user, IShare $share): void {
88-
$this->userMountCache->removeMount($this->getMountPointFromTarget($user, $share->getTarget()), $user);
91+
try {
92+
$userShare = $this->shareManager->getShareById($share->getFullId(), $user->getUID());
93+
$this->userMountCache->removeMount($this->getMountPointFromTarget($user, $userShare->getTarget()), $user);
94+
} catch (ShareNotFound) {
95+
// user doesn't actually have access to the share
96+
}
8997
}
9098

9199
/**

0 commit comments

Comments
 (0)