diff --git a/lib/Listener/CalDavEventListener.php b/lib/Listener/CalDavEventListener.php index 15ee2af7699..67dfc8bc3ae 100644 --- a/lib/Listener/CalDavEventListener.php +++ b/lib/Listener/CalDavEventListener.php @@ -69,7 +69,7 @@ public function handle(Event $event): void { } if (!str_contains($calData, 'LOCATION:')) { - $this->logger->debug('No location for the even, skipping for calendar event integration'); + $this->logger->debug('No location for the event, skipping for calendar event integration'); return; } @@ -81,6 +81,13 @@ public function handle(Event $event): void { } $vevent = $vobject->VEVENT; + + // Calendar objects can also be VTODO or VJOURNAL for instance + if ($vevent === null) { + $this->logger->debug('Calendar object is not an event, skipping for calendar event integration'); + return; + } + // Check if the location is set and if the location string contains a call url $location = $vevent->LOCATION?->getValue(); if ($location === null || !str_contains($location, '/call/')) { diff --git a/tests/php/Listener/CalDavEventListenerTest.php b/tests/php/Listener/CalDavEventListenerTest.php index d7ea1164664..2586a3da83b 100644 --- a/tests/php/Listener/CalDavEventListenerTest.php +++ b/tests/php/Listener/CalDavEventListenerTest.php @@ -163,6 +163,37 @@ public function testIsCalendarEventSystemCalendar(): void { $this->listener->handle($event); } + public function testIsCalendarEventNoEventInVObject(): void { + $calData = << $this->userUri], [], ['calendardata' => $calData]); + + $this->logger->expects(self::once()) + ->method('debug') + ->with('Calendar object is not an event, skipping for calendar event integration'); + + $this->listener->handle($event); + } + public function testIsCalendarEventNoData(): void { $event = new CalendarObjectCreatedEvent(1, ['principaluri' => $this->userUri], [], []);