From d948a584689ab95228e2aa0406aa1ecd415bedec Mon Sep 17 00:00:00 2001 From: sandro-byte32 <75497753+sandro-byte32@users.noreply.github.com> Date: Sat, 10 Aug 2024 01:37:32 +0200 Subject: [PATCH] Update Caldav_sync.php for correct URI parsing --- application/libraries/Caldav_sync.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/libraries/Caldav_sync.php b/application/libraries/Caldav_sync.php index e03df821..deb2978f 100644 --- a/application/libraries/Caldav_sync.php +++ b/application/libraries/Caldav_sync.php @@ -72,7 +72,7 @@ class Caldav_sync $caldav_event_id = $appointment['id_caldav_calendar'] ?: $this->CI->ics_file->generate_uid($appointment['id']); - $uri = $this->get_caldav_event_uri($caldav_event_id); + $uri = $this->get_caldav_event_uri($provider['settings']['caldav_url'], $caldav_event_id); $client->request('PUT', $uri, [ 'headers' => [ @@ -108,7 +108,7 @@ class Caldav_sync $caldav_event_id = $unavailability['id_caldav_calendar'] ?: $this->CI->ics_file->generate_uid($unavailability['id']); - $uri = $this->get_caldav_event_uri($caldav_event_id); + $uri = $this->get_caldav_event_uri($provider['settings']['caldav_url'], $caldav_event_id); $client->request('PUT', $uri, [ 'headers' => [ @@ -135,7 +135,7 @@ class Caldav_sync try { $client = $this->get_http_client_by_provider_id($provider['id']); - $uri = $this->get_caldav_event_uri($caldav_event_id); + $uri = $this->get_caldav_event_uri($provider['settings']['caldav_url'], $caldav_event_id); $client->request('DELETE', $uri); } catch (GuzzleException $e) { @@ -157,7 +157,7 @@ class Caldav_sync try { $client = $this->get_http_client_by_provider_id($provider['id']); - $uri = $this->get_caldav_event_uri($caldav_event_id); + $uri = $this->get_caldav_event_uri($provider['settings']['caldav_url'], $caldav_event_id); $response = $client->request('GET', $uri); @@ -303,9 +303,9 @@ class Caldav_sync * * @return string */ - private function get_caldav_event_uri(?string $caldav_event_id = null): string + private function get_caldav_event_uri(string $caldav_calendar, ?string $caldav_event_id = null): string { - return $caldav_event_id ? '/' . $caldav_event_id . '.ics' : ''; + return rtrim($caldav_calendar, '/') . ($caldav_event_id ? '/' . $caldav_event_id . '.ics' : ''); } /**