diff options
author | escoand <escoand@users.noreply.github.com> | 2024-09-25 12:29:12 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-10-02 11:33:18 +0200 |
commit | a5eb38f277d98eac3957e48dc4a3f57a109c44f1 (patch) | |
tree | c428f66f59778f75d85e74660c3fc8883d853ff5 /apps/dav/lib | |
parent | b3ca5b51711408ca25a4a4da56c820f923f6103b (diff) | |
download | nextcloud-server-a5eb38f277d98eac3957e48dc4a3f57a109c44f1.tar.gz nextcloud-server-a5eb38f277d98eac3957e48dc4a3f57a109c44f1.zip |
fix(dav): don't crash subscription on invalid calendar objectbug/48518/ignore-invalid-dates
Signed-off-by: escoand <escoand@users.noreply.github.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index 348a4e5ddbd..988898fc6d8 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -12,6 +12,7 @@ use OCA\DAV\CalDAV\CalDavBackend; use OCP\AppFramework\Utility\ITimeFactory; use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\BadRequest; +use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\PropPatch; use Sabre\VObject\Component; use Sabre\VObject\DateTimeParser; @@ -101,7 +102,13 @@ class RefreshWebcalService { continue; } - $denormalized = $this->calDavBackend->getDenormalizedData($vObject->serialize()); + try { + $denormalized = $this->calDavBackend->getDenormalizedData($vObject->serialize()); + } catch (InvalidDataException|Forbidden $ex) { + $this->logger->warning('Unable to denormalize calendar object from subscription {subscriptionId}', ['exception' => $ex, 'subscriptionId' => $subscription['id'], 'source' => $subscription['source']]); + continue; + } + // Find all identical sets and remove them from the update if (isset($localData[$uid]) && $denormalized['etag'] === $localData[$uid]['etag']) { unset($localData[$uid]); @@ -127,7 +134,7 @@ class RefreshWebcalService { $objectUri = $this->getRandomCalendarObjectUri(); $this->calDavBackend->createCalendarObject($subscription['id'], $objectUri, $vObject->serialize(), CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); } catch (NoInstancesException|BadRequest $ex) { - $this->logger->error('Unable to create calendar object from subscription {subscriptionId}', ['exception' => $ex, 'subscriptionId' => $subscription['id'], 'source' => $subscription['source']]); + $this->logger->warning('Unable to create calendar object from subscription {subscriptionId}', ['exception' => $ex, 'subscriptionId' => $subscription['id'], 'source' => $subscription['source']]); } } |