diff options
Diffstat (limited to 'apps/files/lib/Service/OwnershipTransferService.php')
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 84c99f32109..afef5d2093d 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -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; |