mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 10:06:37 -04:00
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>
This commit is contained in:
parent
55fd30729e
commit
02aebdcf41
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue