Default DAV folder detection

This commit is contained in:
Aleksander Machniak 2024-05-30 08:34:32 +02:00
parent 2cedf86201
commit 905644dc6c

View file

@ -47,7 +47,13 @@ class kolab_storage_dav_folder extends kolab_storage_folder
$this->valid = true;
[$this->type, $suffix] = strpos($type, '.') ? explode('.', $type) : [$type, ''];
$this->default = $suffix == 'default';
// For DAV we don't really have a standard way to define "default" folders,
// but MS Outlook (ActiveSync) requires them. This will work with Cyrus DAV.
$rx = "~/(calendars|addressbooks)/user/[^/]+/(Default|Tasks)/?$~";
$rx = rcube::get_instance()->config->get('kolab_dav_default_folder_regex') ?: $rx;
$this->default = preg_match($rx, $this->href) === 1;
$this->subtype = $this->default ? '' : $suffix;
// Init cache