Skip to content

Commit 0650444

Browse files
icewind1991artonge
authored andcommitted
fix: move mountpoint when transfering share
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent cd666cb commit 0650444

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

apps/files/lib/Service/OwnershipTransferService.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,16 @@ private function restoreShares(
577577
$output->writeln('');
578578
}
579579

580-
private function transferIncomingShares(string $sourceUid,
580+
private function transferIncomingShares(
581+
string $sourceUid,
581582
string $destinationUid,
582583
array $sourceShares,
583584
array $destinationShares,
584585
OutputInterface $output,
585586
string $path,
586587
string $finalTarget,
587-
bool $move): void {
588+
bool $move,
589+
): void {
588590
$output->writeln('Restoring incoming shares ...');
589591
$progress = new ProgressBar($output, count($sourceShares));
590592
$prefix = "$destinationUid/files";
@@ -623,8 +625,11 @@ private function transferIncomingShares(string $sourceUid,
623625
if ($move) {
624626
continue;
625627
}
628+
$oldMountPoint = $this->getShareMountPoint($destinationUid, $share->getTarget());
629+
$newMountPoint = $this->getShareMountPoint($destinationUid, $shareTarget);
626630
$share->setTarget($shareTarget);
627631
$this->shareManager->moveShare($share, $destinationUid);
632+
$this->mountManager->moveMount($oldMountPoint, $newMountPoint);
628633
continue;
629634
}
630635
$this->shareManager->deleteShare($share);
@@ -642,8 +647,11 @@ private function transferIncomingShares(string $sourceUid,
642647
if ($move) {
643648
continue;
644649
}
650+
$oldMountPoint = $this->getShareMountPoint($destinationUid, $share->getTarget());
651+
$newMountPoint = $this->getShareMountPoint($destinationUid, $shareTarget);
645652
$share->setTarget($shareTarget);
646653
$this->shareManager->moveShare($share, $destinationUid);
654+
$this->mountManager->moveMount($oldMountPoint, $newMountPoint);
647655
continue;
648656
}
649657
} catch (NotFoundException $e) {
@@ -656,4 +664,8 @@ private function transferIncomingShares(string $sourceUid,
656664
$progress->finish();
657665
$output->writeln('');
658666
}
667+
668+
private function getShareMountPoint(string $uid, string $target): string {
669+
return '/' . $uid . '/files/' . trim($target, '/') . '/';
670+
}
659671
}

0 commit comments

Comments
 (0)