From d23f612ce0eef4846f55f750b7a661e93922ae41 Mon Sep 17 00:00:00 2001 From: Stephan Stricker Date: Thu, 25 Jun 2026 20:21:33 +0200 Subject: [PATCH] fix(dav): allow ExternalCalendar as schedule-default-calendar-URL When a user tries to set an ExternalCalendar (e.g. from integration_davc) as the default calendar for scheduling, CustomPropertiesBackend::validateProperty() rejects it with 'No such calendar' because it only accepts instances of OCA\DAV\CalDAV\Calendar, not OCA\DAV\CalDAV\Integration\ExternalCalendar. ExternalCalendar is already imported in the file but was unused in the instanceof check. Extend the validation to also accept ExternalCalendar nodes, running a simplified check (VEVENT support only) since these calendars are always writable and cannot be subscriptions, shared, or deleted. Signed-off-by: stephan1827 --- apps/dav/lib/DAV/CustomPropertiesBackend.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index 8be2af9da8062..8b602e6d91039 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -344,11 +344,23 @@ private function validateProperty(string $path, string $propName, mixed $propVal // $path is the principal here as this prop is only set on principals $node = $this->tree->getNodeForPath($href); - if (!($node instanceof Calendar) || $node->getOwner() !== $path) { + if ((!($node instanceof Calendar) && !($node instanceof ExternalCalendar)) || $node->getOwner() !== $path) { throw new DavException('No such calendar'); } - $this->defaultCalendarValidator->validateScheduleDefaultCalendar($node); + if ($node instanceof Calendar) { + $this->defaultCalendarValidator->validateScheduleDefaultCalendar($node); + } else { + // ExternalCalendar: verify VEVENT support; these calendars are always writable and not subscriptions/shared/deleted + $sCCS = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; + $calendarProperties = $node->getProperties([$sCCS]); + if (isset($calendarProperties[$sCCS])) { + $supportedComponents = $calendarProperties[$sCCS]->getValue(); + if (!in_array('VEVENT', $supportedComponents, true)) { + throw new DavException('Calendar does not support VEVENT components'); + } + } + } break; } }