mirror of
https://github.com/nextcloud/server.git
synced 2026-03-13 14:19:06 -04:00
Merge pull request #31203 from nextcloud/backport/31097/stable22
[stable22] Fix path handling when transferring incoming shares
This commit is contained in:
commit
4cd26d47c3
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