Skip to content

Commit cd306b8

Browse files
miaulalalaAndyScherzinger
authored andcommitted
fix(caldav): explicitly check from component types
Signed-off-by: Anna Larch <anna@nextcloud.com>
1 parent 6b6401f commit cd306b8

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,20 +2995,21 @@ public function getDenormalizedData(string $calendarData): array {
29952995
$classification = self::CLASSIFICATION_PUBLIC;
29962996
$hasDTSTART = false;
29972997
foreach ($vObject->getComponents() as $component) {
2998-
if ($component->name !== 'VTIMEZONE') {
2999-
// Finding all VEVENTs, and track them
3000-
if ($component->name === 'VEVENT') {
3001-
$vEvents[] = $component;
3002-
if ($component->DTSTART) {
3003-
$hasDTSTART = true;
3004-
}
3005-
}
3006-
// Track first component type and uid
3007-
if ($uid === null) {
3008-
$componentType = $component->name;
3009-
$uid = (string)$component->UID;
3010-
}
2998+
if (!in_array($component->name, ['VEVENT', 'VJOURNAL', 'VTODO'])) {
2999+
continue;
30113000
}
3001+
3002+
$vEvents[] = $component;
3003+
if ($component->DTSTART) {
3004+
$hasDTSTART = true;
3005+
}
3006+
3007+
// Track first component type and uid
3008+
if ($uid === null) {
3009+
$componentType = $component->name;
3010+
$uid = (string)$component->UID;
3011+
}
3012+
30123013
}
30133014
if (!$componentType) {
30143015
throw new BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');

0 commit comments

Comments
 (0)