Fix folders discovery on non-kolab DAV servers (T7276)

This commit is contained in:
Aleksander Machniak 2023-06-20 14:31:10 +02:00
parent 5fcf64fd9f
commit 84ef4ac9e3

View file

@ -131,12 +131,6 @@ class kolab_dav_client
}
}
$roots = [
'VEVENT' => 'calendars',
'VTODO' => 'calendars',
'VCARD' => 'addressbooks',
];
$path = parse_url($this->url, PHP_URL_PATH);
$body = '<?xml version="1.0" encoding="utf-8"?>'
@ -147,7 +141,7 @@ class kolab_dav_client
. '</d:propfind>';
// 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,15 +194,13 @@ class kolab_dav_client
}
}
if (!empty($root_href)) {
if (empty($root_href)) {
return false;
}
if ($path && strpos($root_href, $path) === 0) {
$root_href = substr($root_href, strlen($path));
}
}
else {
// Kolab iRony's calendar root
$root_href = '/' . $roots[$component] . '/' . rawurlencode($this->user);
}
if ($cache) {
$cache->set($cache_key, $root_href);