aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-08-26 11:31:39 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-10-14 11:58:47 +0200
commit7a48f8d92907feba985b0dd55e6c9d37a7040c80 (patch)
tree09eeca63a9dc55f18d1c5fbf4f9e129424953ca7 /apps/files
parent7e9bc7c8cf981b4931cd4a75b674c662eddc4bb9 (diff)
downloadnextcloud-server-7a48f8d92907feba985b0dd55e6c9d37a7040c80.tar.gz
nextcloud-server-7a48f8d92907feba985b0dd55e6c9d37a7040c80.zip
fix: Transfer incomming shares first, do not delete non-migratable ones
Canceling the previous add of deletion of invalid shares in transferownership because in some cases it deletes valid reshares, if incoming shares are not transfered on purpose. Inverting the order of transfer between incoming and outgoing so that reshare can be migrated when incoming shares are transfered. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php23
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 191145b7a66..cd43116bd7d 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -147,16 +147,6 @@ class OwnershipTransferService {
$output
);
- $destinationPath = $finalTarget . '/' . $path;
- // restore the shares
- $this->restoreShares(
- $sourceUid,
- $destinationUid,
- $destinationPath,
- $shares,
- $output
- );
-
// transfer the incoming shares
if ($transferIncomingShares === true) {
$sourceShares = $this->collectIncomingShares(
@@ -181,6 +171,16 @@ class OwnershipTransferService {
$move
);
}
+
+ $destinationPath = $finalTarget . '/' . $path;
+ // restore the shares
+ $this->restoreShares(
+ $sourceUid,
+ $destinationUid,
+ $destinationPath,
+ $shares,
+ $output
+ );
}
private function sanitizeFolderName(string $name): string {
@@ -467,9 +467,6 @@ class OwnershipTransferService {
}
} catch (\OCP\Files\NotFoundException $e) {
$output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
- } catch (\OCP\Share\Exceptions\GenericShareException $e) {
- $output->writeln('<error>Share with id ' . $share->getId() . ' is broken, deleting</error>');
- $this->shareManager->deleteShare($share);
} catch (\Throwable $e) {
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . ' : ' . $e->getTraceAsString() . '</error>');
}