Skip to content

Commit

Permalink
fix: skip transfering shares that we can't find
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Dec 10, 2024
1 parent 1f87fa6 commit f002cf7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions apps/files/lib/Service/OwnershipTransferService.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,19 @@ private function collectUsersShares(
$progress->finish();
$output->writeln('');

return array_map(fn (IShare $share) => [
'share' => $share,
'suffix' => substr(Filesystem::normalizePath($view->getPath($share->getNodeId())), strlen($normalizedPath)),
], $shares);
return array_values(array_filter(array_map(function (IShare $share) use ($view, $normalizedPath, $output, $sourceUid) {
try {
$nodePath = $view->getPath($share->getNodeId());
} catch (NotFoundException $e) {
$output->writeln("<error>Failed to find path for shared file {$share->getNodeId()} for user $sourceUid, skipping</error>");
return null;
}

return [
'share' => $share,
'suffix' => substr(Filesystem::normalizePath($nodePath), strlen($normalizedPath)),
];
}, $shares)));
}

private function collectIncomingShares(string $sourceUid,
Expand Down

0 comments on commit f002cf7

Please sign in to comment.