Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-02-10 11:50:21 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-02-16 12:49:29 +0300
commit02aebdcf41455ac3519b5c845d1e3bce1befeee6 (patch)
treeaa4ce5243b8947a32bf00965d593caa642779af3
parent55fd30729e86a94e121f6c99cd66ae03e3d76264 (diff)
Fix path handling when transferring incoming shares
When transferring incoming shares from a guest user without specifying a path, the $path is empty. The fix properly handles that situation to avoid looking for shares in a path with doubled slashes which failed to find shares to transfer. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php6
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;
}