diff --git a/lib/Listener/CalDavEventListener.php b/lib/Listener/CalDavEventListener.php index fa47a9b7c2d..5a2326f7bdb 100644 --- a/lib/Listener/CalDavEventListener.php +++ b/lib/Listener/CalDavEventListener.php @@ -70,7 +70,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; } @@ -82,6 +82,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 5f106a8b194..4a876d4ac4e 100644 --- a/tests/php/Listener/CalDavEventListenerTest.php +++ b/tests/php/Listener/CalDavEventListenerTest.php @@ -162,6 +162,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], [], []);