Skip to content

Commit c4c9421

Browse files
icewind1991AndyScherzinger
authored andcommitted
fix: skip transfering shares that we can't find
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 1e61dd3 commit c4c9421

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

apps/files/lib/Service/OwnershipTransferService.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,19 @@ private function collectUsersShares(
365365
$progress->finish();
366366
$output->writeln('');
367367

368-
return array_map(fn (IShare $share) => [
369-
'share' => $share,
370-
'suffix' => substr(Filesystem::normalizePath($view->getPath($share->getNodeId())), strlen($normalizedPath)),
371-
], $shares);
368+
return array_values(array_filter(array_map(function (IShare $share) use ($view, $normalizedPath, $output, $sourceUid) {
369+
try {
370+
$nodePath = $view->getPath($share->getNodeId());
371+
} catch (NotFoundException $e) {
372+
$output->writeln("<error>Failed to find path for shared file {$share->getNodeId()} for user $sourceUid, skipping</error>");
373+
return null;
374+
}
375+
376+
return [
377+
'share' => $share,
378+
'suffix' => substr(Filesystem::normalizePath($nodePath), strlen($normalizedPath)),
379+
];
380+
}, $shares)));
372381
}
373382

374383
private function collectIncomingShares(string $sourceUid,

0 commit comments

Comments
 (0)