From 84ef4ac9e3c26a32b65ea7ed8a0e492c8ee715a0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 20 Jun 2023 14:31:10 +0200 Subject: [PATCH] Fix folders discovery on non-kolab DAV servers (T7276) --- plugins/libkolab/lib/kolab_dav_client.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/plugins/libkolab/lib/kolab_dav_client.php b/plugins/libkolab/lib/kolab_dav_client.php index 8471da02..a9dc056f 100644 --- a/plugins/libkolab/lib/kolab_dav_client.php +++ b/plugins/libkolab/lib/kolab_dav_client.php @@ -131,12 +131,6 @@ class kolab_dav_client } } - $roots = [ - 'VEVENT' => 'calendars', - 'VTODO' => 'calendars', - 'VCARD' => 'addressbooks', - ]; - $path = parse_url($this->url, PHP_URL_PATH); $body = '' @@ -147,7 +141,7 @@ class kolab_dav_client . ''; // Note: Cyrus CardDAV service requires Depth:1 (CalDAV works without it) - $response = $this->request('/' . $roots[$component], 'PROPFIND', $body, ['Depth' => 1, 'Prefer' => 'return-minimal']); + $response = $this->request('/', 'PROPFIND', $body, ['Depth' => 1, 'Prefer' => 'return-minimal']); if (empty($response)) { return false; @@ -200,14 +194,12 @@ class kolab_dav_client } } - if (!empty($root_href)) { - if ($path && strpos($root_href, $path) === 0) { - $root_href = substr($root_href, strlen($path)); - } + if (empty($root_href)) { + return false; } - else { - // Kolab iRony's calendar root - $root_href = '/' . $roots[$component] . '/' . rawurlencode($this->user); + + if ($path && strpos($root_href, $path) === 0) { + $root_href = substr($root_href, strlen($path)); } if ($cache) {