diff options
author | Robin Appelman <robin@icewind.nl> | 2024-12-10 18:23:02 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2025-01-03 15:21:17 +0100 |
commit | c00724bac813eec725912ba288da77686406b09a (patch) | |
tree | 2ea8dd03c37a164c59aba1a46b90a098fb09fdce | |
parent | b16f5a00435e9356cbbd757b7fadb5823d8f903a (diff) | |
download | nextcloud-server-transfer-share-skip-notfound.tar.gz nextcloud-server-transfer-share-skip-notfound.zip |
fix: skip transfering shares that we can't findtransfer-share-skip-notfound
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 71764019abf..437ad25781e 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -340,10 +340,19 @@ class OwnershipTransferService { $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, |