Skip to content

Commit c662ccf

Browse files
ChristophWurstkesselb
authored andcommitted
fix(caldav): Ignore invalid events for reminder generation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent a2ac818 commit c662ccf

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

apps/dav/lib/CalDAV/Reminder/ReminderService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,10 @@ private function getAllVEventsFromVCalendar(VObject\Component\VCalendar $vcalend
786786
if ($child->name !== 'VEVENT') {
787787
continue;
788788
}
789+
// Ignore invalid events with no DTSTART
790+
if ($child->DTSTART === null) {
791+
continue;
792+
}
789793

790794
$vevents[] = $child;
791795
}

apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,48 @@ public function testOnCalendarObjectCreateSingleEntry():void {
342342
$this->reminderService->onCalendarObjectCreate($objectData);
343343
}
344344

345+
/**
346+
* RFC5545 says DTSTART is REQUIRED, but we have seen event without the prop
347+
*/
348+
public function testOnCalendarObjectCreateNoDtstart(): void {
349+
$calendarData = <<<EOD
350+
BEGIN:VCALENDAR
351+
PRODID:-//Nextcloud calendar v1.6.4
352+
BEGIN:VEVENT
353+
CREATED:20160602T133732
354+
DTSTAMP:20160602T133732
355+
LAST-MODIFIED:20160602T133732
356+
UID:wej2z68l9h
357+
SUMMARY:Test Event
358+
BEGIN:VALARM
359+
ACTION:EMAIL
360+
TRIGGER:-PT15M
361+
END:VALARM
362+
BEGIN:VALARM
363+
ACTION:DISPLAY
364+
TRIGGER;VALUE=DATE-TIME:20160608T000000Z
365+
END:VALARM
366+
END:VEVENT
367+
END:VCALENDAR
368+
EOD;
369+
$objectData = [
370+
'calendardata' => $calendarData,
371+
'id' => '42',
372+
'calendarid' => '1337',
373+
'component' => 'vevent',
374+
];
375+
376+
$this->backend->expects($this->never())
377+
->method('insertReminder')
378+
->withConsecutive(
379+
[1337, 42, 'wej2z68l9h', false, null, false, '5c70531aab15c92b52518ae10a2f78a4', 'de919af7429d3b5c11e8b9d289b411a6', 'EMAIL', true, 1465429500, false],
380+
[1337, 42, 'wej2z68l9h', false, null, false, '5c70531aab15c92b52518ae10a2f78a4', '35b3eae8e792aa2209f0b4e1a302f105', 'DISPLAY', false, 1465344000, false]
381+
)
382+
->willReturn(1);
383+
384+
$this->reminderService->onCalendarObjectCreate($objectData);
385+
}
386+
345387
public function testOnCalendarObjectCreateSingleEntryWithRepeat(): void {
346388
$objectData = [
347389
'calendardata' => self::CALENDAR_DATA_REPEAT,

0 commit comments

Comments
 (0)