diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-02-10 17:47:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 17:47:41 +0100 |
commit | 1a9e6f1571b04946c0214cb49a565427190803c0 (patch) | |
tree | b0523dc47312c61764f05cb5fc508e4c883e6a5b /apps/files | |
parent | b881940bf31a45de81ade6cbe3f2e870846866ad (diff) | |
parent | 7858fee5b53e640ed04b5ec54034c75e22124fd6 (diff) | |
download | nextcloud-server-1a9e6f1571b04946c0214cb49a565427190803c0.tar.gz nextcloud-server-1a9e6f1571b04946c0214cb49a565427190803c0.zip |
Merge pull request #31097 from nextcloud/bugfix/31096/fix-shares-transfer-guest-to-nonguest
Fix path handling when transferring incoming shares
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 93a3a188399..670e6419d75 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -444,13 +444,17 @@ class OwnershipTransferService { $output->writeln("Restoring incoming shares ..."); $progress = new ProgressBar($output, count($sourceShares)); $prefix = "$destinationUid/files"; + $finalShareTarget = ''; if (substr($finalTarget, 0, strlen($prefix)) === $prefix) { $finalShareTarget = substr($finalTarget, strlen($prefix)); } foreach ($sourceShares as $share) { try { // Only restore if share is in given path. - $pathToCheck = '/' . trim($path) . '/'; + $pathToCheck = '/'; + if (trim($path, '/') !== '') { + $pathToCheck = '/' . trim($path) . '/'; + } if (substr($share->getTarget(), 0, strlen($pathToCheck)) !== $pathToCheck) { continue; } |