Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/Listener/CalDavEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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/')) {
Expand Down
31 changes: 31 additions & 0 deletions tests/php/Listener/CalDavEventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,37 @@ public function testIsCalendarEventSystemCalendar(): void {
$this->listener->handle($event);
}

public function testIsCalendarEventNoEventInVObject(): void {
$calData = <<<EOD
BEGIN:VCALENDAR
PRODID:-//IDN nextcloud.com//Something fancy//EN
CALSCALE:GREGORIAN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Paris
X-LIC-LOCATION:Europe/Paris
END:VTIMEZONE
BEGIN:VTODO
CREATED:20250310T171800Z
DTSTAMP:20250310T171819Z
LAST-MODIFIED:20250310T171819Z
UID:4d336aa1-a29e-4015-b1dd-98e1dae802db
DTSTART;TZID=Europe/Vienna:20250314T100000
DUE;TZID=Europe/Vienna:20250314T110000
STATUS:CONFIRMED
SUMMARY:Test
END:VTODO
END:VCALENDAR
EOD;
$event = new CalendarObjectCreatedEvent(1, ['principaluri' => $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], [], []);

Expand Down
Loading