Skip to content

Commit f002cf7

Browse files
committed
fix: skip transfering shares that we can't find
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 1f87fa6 commit f002cf7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

apps/files/lib/Service/OwnershipTransferService.php

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

343-
return array_map(fn (IShare $share) => [
344-
'share' => $share,
345-
'suffix' => substr(Filesystem::normalizePath($view->getPath($share->getNodeId())), strlen($normalizedPath)),
346-
], $shares);
343+
return array_values(array_filter(array_map(function (IShare $share) use ($view, $normalizedPath, $output, $sourceUid) {
344+
try {
345+
$nodePath = $view->getPath($share->getNodeId());
346+
} catch (NotFoundException $e) {
347+
$output->writeln("<error>Failed to find path for shared file {$share->getNodeId()} for user $sourceUid, skipping</error>");
348+
return null;
349+
}
350+
351+
return [
352+
'share' => $share,
353+
'suffix' => substr(Filesystem::normalizePath($nodePath), strlen($normalizedPath)),
354+
];
355+
}, $shares)));
347356
}
348357

349358
private function collectIncomingShares(string $sourceUid,

0 commit comments

Comments
 (0)