From cd306b80e56a865ac4ef7f12b29a7db0c088ef1f Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Tue, 17 Sep 2024 12:59:55 +0200 Subject: [PATCH] fix(caldav): explicitly check from component types Signed-off-by: Anna Larch --- apps/dav/lib/CalDAV/CalDavBackend.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 0c8b52a7491c7..614bfc63b44f0 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -2995,20 +2995,21 @@ public function getDenormalizedData(string $calendarData): array { $classification = self::CLASSIFICATION_PUBLIC; $hasDTSTART = false; foreach ($vObject->getComponents() as $component) { - if ($component->name !== 'VTIMEZONE') { - // Finding all VEVENTs, and track them - if ($component->name === 'VEVENT') { - $vEvents[] = $component; - if ($component->DTSTART) { - $hasDTSTART = true; - } - } - // Track first component type and uid - if ($uid === null) { - $componentType = $component->name; - $uid = (string)$component->UID; - } + if (!in_array($component->name, ['VEVENT', 'VJOURNAL', 'VTODO'])) { + continue; } + + $vEvents[] = $component; + if ($component->DTSTART) { + $hasDTSTART = true; + } + + // Track first component type and uid + if ($uid === null) { + $componentType = $component->name; + $uid = (string)$component->UID; + } + } if (!$componentType) { throw new BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');