mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix: don't use view->getPath in ownership transfer
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
34d5a103b4
commit
06154dd116
1 changed files with 4 additions and 9 deletions
|
|
@ -333,15 +333,10 @@ class OwnershipTransferService {
|
|||
if ($path !== "$sourceUid/files") {
|
||||
$sharePage = array_filter($sharePage, function (IShare $share) use ($view, $normalizedPath) {
|
||||
try {
|
||||
$relativePath = $view->getPath($share->getNodeId());
|
||||
$singleFileTranfer = $view->is_file($normalizedPath);
|
||||
if ($singleFileTranfer) {
|
||||
return Filesystem::normalizePath($relativePath) === $normalizedPath;
|
||||
}
|
||||
$sourceNode = $share->getNode();
|
||||
$relativePath = $view->getRelativePath($sourceNode->getPath());
|
||||
|
||||
return mb_strpos(
|
||||
Filesystem::normalizePath($relativePath . '/', false),
|
||||
$normalizedPath . '/') === 0;
|
||||
return str_starts_with($relativePath . '/', $normalizedPath . '/');
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -357,7 +352,7 @@ class OwnershipTransferService {
|
|||
|
||||
return array_values(array_filter(array_map(function (IShare $share) use ($view, $normalizedPath, $output, $sourceUid) {
|
||||
try {
|
||||
$nodePath = $view->getPath($share->getNodeId());
|
||||
$nodePath = $view->getRelativePath($share->getNode()->getPath());
|
||||
} catch (NotFoundException $e) {
|
||||
$output->writeln("<error>Failed to find path for shared file {$share->getNodeId()} for user $sourceUid, skipping</error>");
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue