diff options
author | Louis <6653109+artonge@users.noreply.github.com> | 2022-02-16 14:31:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 14:31:52 +0300 |
commit | 4cd26d47c382accbfba37d3bc874c9534cb6830d (patch) | |
tree | 46f7c7eb82d0fe4dbafac6baf3858e0da5e59419 /apps | |
parent | cde0a35e9328baac508b417795c94db1ccbe4949 (diff) | |
parent | 02aebdcf41455ac3519b5c845d1e3bce1befeee6 (diff) |
Merge pull request #31203 from nextcloud/backport/31097/stable22
[stable22] Fix path handling when transferring incoming shares
Diffstat (limited to 'apps')
-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; } |