From e5c4c4ff1a0163a9fa6b4f5e68670c1eac4b20e9 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 15 Mar 2026 12:58:41 +0100 Subject: [PATCH] sharing/bday: fix backmapping --- radicale/app/propfind.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 995add83..138584ec 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -112,25 +112,30 @@ def xml_propfind_response( logger.debug("TRACE/PROPFIND/xml_propfind: sharetype=%r item.path=%r", sharetype, uri) for entry in shares: if logger.isEnabledFor(logging.DEBUG): - logger.debug("TRACE/PROPFIND/xml_propfind: entry=%r", entry) + logger.debug("TRACE/PROPFIND/xml_propfind: check entry=%r", entry) if entry is not None: - if shares[entry]['PathMapped'] == uri: + if logger.isEnabledFor(logging.DEBUG): + logger.debug("TRACE/PROPFIND/xml_propfind: PathMapped=%r uri=%r", shares[entry]['PathMapped'], uri) + if uri.startswith(shares[entry]['PathMapped']): if sharetype is None or shares[entry]['ShareType'] == sharetype: share = shares[entry] if logger.isEnabledFor(logging.DEBUG): - logger.debug("TRACE/PROPFIND/xml_propfind: share=%r", share) + logger.debug("TRACE/PROPFIND/xml_propfind: found share=%r", share) break - if share: - # backmap - uri = uri.replace(share['PathMapped'], share['PathOrToken']) - href.text = xmlutils.make_href(base_prefix, uri) - response.append(href) - share_bday_automap = False if share and share['ShareType'] == "bday": share_bday_automap = True + if share: + # backmap + uri = uri.replace(share['PathMapped'], share['PathOrToken']) + if share_bday_automap and not uri.endswith("/"): + uri = uri.rstrip(".vcf") + ".ics" + + href.text = xmlutils.make_href(base_prefix, uri) + response.append(href) + if propname or allprop: props = [] # Should list all properties that can be retrieved by the code below @@ -431,6 +436,9 @@ def xml_propfind_response( elif tag == xmlutils.make_clark("D:getcontenttype"): assert not isinstance(item, storage.BaseCollection) element.text = xmlutils.get_content_type(item, encoding) + if share_bday_automap: + # overwrite + element.text = xmlutils.MIMETYPES["VCALENDAR"] elif tag == xmlutils.make_clark("D:resourcetype"): # resourcetype must be returned empty for non-collection elements pass