mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 01:52:22 +03:00
Update Caldav_sync.php for correct URI parsing
This commit is contained in:
parent
dcf9015541
commit
d948a58468
1 changed files with 6 additions and 6 deletions
|
@ -72,7 +72,7 @@ class Caldav_sync
|
||||||
$caldav_event_id =
|
$caldav_event_id =
|
||||||
$appointment['id_caldav_calendar'] ?: $this->CI->ics_file->generate_uid($appointment['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, [
|
$client->request('PUT', $uri, [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
|
@ -108,7 +108,7 @@ class Caldav_sync
|
||||||
$caldav_event_id =
|
$caldav_event_id =
|
||||||
$unavailability['id_caldav_calendar'] ?: $this->CI->ics_file->generate_uid($unavailability['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, [
|
$client->request('PUT', $uri, [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
|
@ -135,7 +135,7 @@ class Caldav_sync
|
||||||
try {
|
try {
|
||||||
$client = $this->get_http_client_by_provider_id($provider['id']);
|
$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);
|
$client->request('DELETE', $uri);
|
||||||
} catch (GuzzleException $e) {
|
} catch (GuzzleException $e) {
|
||||||
|
@ -157,7 +157,7 @@ class Caldav_sync
|
||||||
try {
|
try {
|
||||||
$client = $this->get_http_client_by_provider_id($provider['id']);
|
$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);
|
$response = $client->request('GET', $uri);
|
||||||
|
|
||||||
|
@ -303,9 +303,9 @@ class Caldav_sync
|
||||||
*
|
*
|
||||||
* @return string
|
* @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' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue