diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-05-18 01:23:30 +0000 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-02-23 15:22:31 +0100 |
commit | 07bf1298090075295535684ff9ecb601ac8237d9 (patch) | |
tree | 65692feed3e46466ffa74a2104c82cbbb9510acb /apps/dav | |
parent | fa773ece6dac48ed4ff15b51341eec31c2b13052 (diff) | |
download | nextcloud-server-07bf1298090075295535684ff9ecb601ac8237d9.tar.gz nextcloud-server-07bf1298090075295535684ff9ecb601ac8237d9.zip |
Skip instead of throwing on invalid calendar migration
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/UserMigration/CalendarMigrator.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php index 14ea4459435..22a20703024 100644 --- a/apps/dav/lib/UserMigration/CalendarMigrator.php +++ b/apps/dav/lib/UserMigration/CalendarMigrator.php @@ -182,6 +182,9 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { ))); } + /** + * @throws InvalidCalendarException + */ private function getUniqueCalendarUri(IUser $user, string $initialCalendarUri): string { $principalUri = $this->getPrincipalUri($user); @@ -190,7 +193,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { : CalendarMigrator::MIGRATED_URI_PREFIX . $initialCalendarUri; if ($initialCalendarUri === '') { - throw new CalendarMigratorException('Failed to get unique calendar URI'); + throw new InvalidCalendarException(); } $existingCalendarUris = array_map( @@ -457,17 +460,20 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator { VObjectReader::OPTION_FORGIVING, ); } catch (Throwable $e) { - throw new CalendarMigratorException("Failed to read file \"$importPath\"", 0, $e); + $output->writeln("Failed to read file \"$importPath\", skipping…"); + continue; } $problems = $vCalendar->validate(); if (!empty($problems)) { - throw new CalendarMigratorException("Invalid calendar data contained in \"$importPath\""); + $output->writeln("Invalid calendar data contained in \"$importPath\", skipping…"); + continue; } $splitFilename = explode('.', $filename, 2); if (count($splitFilename) !== 2) { - throw new CalendarMigratorException("Invalid filename \"$filename\", expected filename of the format \"<calendar_name>" . CalendarMigrator::FILENAME_EXT . '"'); + $output->writeln("Invalid filename \"$filename\", expected filename of the format \"<calendar_name>" . CalendarMigrator::FILENAME_EXT . '", skipping…'); + continue; } [$initialCalendarUri, $ext] = $splitFilename; |