From 0da5cb3b85eeb80c1dc9c043198cb424e25f560c Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Wed, 6 Sep 2023 17:48:21 +0200 Subject: [PATCH] fix(caldav): add webroot to objectid for activities A calendar uri includes the webroot: example.com/cloud/remote.php/dav/calendars/alice/personal/ The calendar app uses base64(calendar uri) as identifier for calendar objects. Without this patch the links from activity app to calendar app don't work for installations in a subdirectory. Signed-off-by: Daniel Kesselberg --- apps/dav/lib/CalDAV/Activity/Provider/Event.php | 2 +- apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 9ae04aadbba36..13f0036b0b032 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -97,7 +97,7 @@ protected function generateObjectParameter(array $eventData) { // The calendar app needs to be manually loaded for the routes to be loaded OC_App::loadApp('calendar'); $linkData = $eventData['link']; - $objectId = base64_encode('/remote.php/dav/calendars/' . $linkData['owner'] . '/' . $linkData['calendar_uri'] . '/' . $linkData['object_uri']); + $objectId = base64_encode($this->url->getWebroot() . '/remote.php/dav/calendars/' . $linkData['owner'] . '/' . $linkData['calendar_uri'] . '/' . $linkData['object_uri']); $link = [ 'view' => 'dayGridMonth', 'timeRange' => 'now', diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php index 583ac6ca725d0..253e162822977 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php @@ -121,6 +121,8 @@ public function testGenerateObjectParameter(int $id, string $name, ?array $link, ->with('calendar') ->willReturn($calendarAppEnabled); if ($calendarAppEnabled) { + $this->url->expects($this->once()) + ->method('getWebroot'); $this->url->expects($this->once()) ->method('linkToRouteAbsolute') ->with('calendar.view.indexview.timerange.edit', $generatedLink)