diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-07-12 01:01:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 01:01:40 +0200 |
commit | 421fec8f5f39817e8716a3886b2a6386aba48337 (patch) | |
tree | 621319faf149d89e1b1e4c52c5e3f8e9e891c092 /apps/dav | |
parent | 8adad15e7779fd13a65f0b544dcdf47374faa471 (diff) | |
parent | 1bbeffa4a59fc7edcfc44bd165c928401edb29b5 (diff) | |
download | nextcloud-server-421fec8f5f39817e8716a3886b2a6386aba48337.tar.gz nextcloud-server-421fec8f5f39817e8716a3886b2a6386aba48337.zip |
Merge pull request #38572 from nextcloud/backport/38301/stable27
[stable27] fix(caldav): Ignore invalid events for reminder generation
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CalDAV/Reminder/ReminderService.php | 4 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php | 42 |
2 files changed, 46 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index 984e29f1e4d..d4b22911099 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -793,6 +793,10 @@ class ReminderService { if ($child->name !== 'VEVENT') { continue; } + // Ignore invalid events with no DTSTART + if ($child->DTSTART === null) { + continue; + } $vevents[] = $child; } diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index 710c6da0307..5ff9dc36cf0 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -342,6 +342,48 @@ ICS; $this->reminderService->onCalendarObjectCreate($objectData); } + /** + * RFC5545 says DTSTART is REQUIRED, but we have seen event without the prop + */ + public function testOnCalendarObjectCreateNoDtstart(): void { + $calendarData = <<<EOD +BEGIN:VCALENDAR +PRODID:-//Nextcloud calendar v1.6.4 +BEGIN:VEVENT +CREATED:20160602T133732 +DTSTAMP:20160602T133732 +LAST-MODIFIED:20160602T133732 +UID:wej2z68l9h +SUMMARY:Test Event +BEGIN:VALARM +ACTION:EMAIL +TRIGGER:-PT15M +END:VALARM +BEGIN:VALARM +ACTION:DISPLAY +TRIGGER;VALUE=DATE-TIME:20160608T000000Z +END:VALARM +END:VEVENT +END:VCALENDAR +EOD; + $objectData = [ + 'calendardata' => $calendarData, + 'id' => '42', + 'calendarid' => '1337', + 'component' => 'vevent', + ]; + + $this->backend->expects($this->never()) + ->method('insertReminder') + ->withConsecutive( + [1337, 42, 'wej2z68l9h', false, null, false, '5c70531aab15c92b52518ae10a2f78a4', 'de919af7429d3b5c11e8b9d289b411a6', 'EMAIL', true, 1465429500, false], + [1337, 42, 'wej2z68l9h', false, null, false, '5c70531aab15c92b52518ae10a2f78a4', '35b3eae8e792aa2209f0b4e1a302f105', 'DISPLAY', false, 1465344000, false] + ) + ->willReturn(1); + + $this->reminderService->onCalendarObjectCreate($objectData); + } + public function testOnCalendarObjectCreateSingleEntryWithRepeat(): void { $objectData = [ 'calendardata' => self::CALENDAR_DATA_REPEAT, |