aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorDaniel <mail@danielkesselberg.de>2025-01-16 17:58:06 +0100
committerGitHub <noreply@github.com>2025-01-16 17:58:06 +0100
commitf9354dab23af19543c669d69c0b0aef8cc46438e (patch)
tree5c6c066276b713071dc84a637eb10dc52eb5b556 /apps/files
parent626bc7220b4feb61b6ef097087be4d44c2a8a570 (diff)
parentc00724bac813eec725912ba288da77686406b09a (diff)
downloadnextcloud-server-f9354dab23af19543c669d69c0b0aef8cc46438e.tar.gz
nextcloud-server-f9354dab23af19543c669d69c0b0aef8cc46438e.zip
Merge pull request #49761 from nextcloud/transfer-share-skip-notfound
fix: skip transfering shares that we can't find
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 385e5ffb92e..23eb4f9df61 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,