Skip to content

Commit

Permalink
fix(caldav): explicitly check from component types
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala committed Sep 17, 2024
1 parent f8dde2d commit a65cf51
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -2988,20 +2988,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');
Expand Down

0 comments on commit a65cf51

Please sign in to comment.