fix: don't use view->getPath in ownership transfer

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/54384/head
Robin Appelman 2025-08-13 11:55:51 +07:00
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;