From 3385cd43428f897adc3ad6d7b2a8506678bccfa8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 16 Mar 2026 23:07:15 +0100 Subject: [PATCH] fix: move mountpoint when transfering share Signed-off-by: Robin Appelman --- .../lib/Service/OwnershipTransferService.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 5ee25e98ea8..3864710ba3d 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -577,14 +577,16 @@ class OwnershipTransferService { $output->writeln(''); } - private function transferIncomingShares(string $sourceUid, + private function transferIncomingShares( + string $sourceUid, string $destinationUid, array $sourceShares, array $destinationShares, OutputInterface $output, string $path, string $finalTarget, - bool $move): void { + bool $move, + ): void { $output->writeln('Restoring incoming shares ...'); $progress = new ProgressBar($output, count($sourceShares)); $prefix = "$destinationUid/files"; @@ -623,8 +625,11 @@ class OwnershipTransferService { if ($move) { continue; } + $oldMountPoint = $this->getShareMountPoint($destinationUid, $share->getTarget()); + $newMountPoint = $this->getShareMountPoint($destinationUid, $shareTarget); $share->setTarget($shareTarget); $this->shareManager->moveShare($share, $destinationUid); + $this->mountManager->moveMount($oldMountPoint, $newMountPoint); continue; } $this->shareManager->deleteShare($share); @@ -642,8 +647,11 @@ class OwnershipTransferService { if ($move) { continue; } + $oldMountPoint = $this->getShareMountPoint($destinationUid, $share->getTarget()); + $newMountPoint = $this->getShareMountPoint($destinationUid, $shareTarget); $share->setTarget($shareTarget); $this->shareManager->moveShare($share, $destinationUid); + $this->mountManager->moveMount($oldMountPoint, $newMountPoint); continue; } } catch (NotFoundException $e) { @@ -656,4 +664,8 @@ class OwnershipTransferService { $progress->finish(); $output->writeln(''); } + + private function getShareMountPoint(string $uid, string $target): string { + return '/' . $uid . '/files/' . trim($target, '/') . '/'; + } }