From eae5566865b0dfba05f9cb416d3e8c894f66b460 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 24 Mar 2026 18:22:12 +0100 Subject: [PATCH] sharing: bugfix on replacement --- radicale/app/propfind.py | 12 ++++++------ radicale/app/report.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 3d674c96..1e5dc005 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -130,7 +130,7 @@ def xml_propfind_response( if share: # backmap if uri.startswith(share['PathMapped']): - uri = share['PathOrToken'] + uri.removeprefix(share['PathMapped']) + uri = str(share['PathOrToken']) + uri.removeprefix(share['PathMapped']) if share_bday_automap and not uri.endswith("/"): uri = uri.rstrip(".vcf") + ".ics" @@ -219,9 +219,9 @@ def xml_propfind_response( if share: # backmap if child_element.text.startswith(share['PathMapped']): - child_element.text = share['PathOrToken'] + child_element.text.removeprefix(share['PathMapped']) - if share_bday_automap: - child_element.text = child_element.text.rstrip(".vcf") + ".ics" + child_element.text = str(share['PathOrToken']) + child_element.text.removeprefix(share['PathMapped']) + if share_bday_automap and child_element.text.endswith(".vcf"): + child_element.text = child_element.text.removesuffix(".vcf") + ".ics" element.append(child_element) elif tag == xmlutils.make_clark("C:supported-calendar-component-set"): human_tag = xmlutils.make_human_tag(tag) @@ -262,8 +262,8 @@ def xml_propfind_response( # backmap child_element.text = xmlutils.make_href( base_prefix, "/%s/" % share['User']) - if share_bday_automap: - child_element.text = child_element.text.rstrip(".vcf") + ".ics" + if share_bday_automap and child_element.text.endswith(".vcf"): + child_element.text = child_element.text.removesuffix(".vcf") + ".ics" else: child_element.text = xmlutils.make_href( base_prefix, "/%s/" % user) diff --git a/radicale/app/report.py b/radicale/app/report.py index 1c853cdb..dba007be 100644 --- a/radicale/app/report.py +++ b/radicale/app/report.py @@ -750,9 +750,9 @@ def xml_item_response(base_prefix: str, href: str, if share: # backmap if href_element.text.startswith(share['PathMapped']): - href_element.text = share['PathOrToken'] + href_element.text.removeprefix(share['PathMapped']) - if share_bday_automap: - href_element.text = href_element.text.rstrip(".vcf") + ".ics" + href_element.text = str(share['PathOrToken']) + href_element.text.removeprefix(share['PathMapped']) + if share_bday_automap and href_element.text.endswith(".vcf"): + href_element.text = href_element.text.removesuffix(".vcf") + ".ics" if logger.isEnabledFor(logging.DEBUG): logger.debug("TRACE/REPORT/xml_report: href=%r (backmapped)", href_element.text) response.append(href_element) @@ -798,10 +798,10 @@ def retrieve_items( if share: # map back to owner if hreference.startswith(share['PathOrToken']): - hreference = share['PathMapped'] + hreference.removeprefix(share['PathOrToken']) + hreference = str(share['PathMapped']) + hreference.removeprefix(share['PathOrToken']) if share['Conversion'] == "bday": - if not hreference.endswith('/'): - hreference = hreference.rstrip(".ics") + ".vcf" + if hreference.endswith(".ics"): + hreference = hreference.removesuffix(".ics") + ".vcf" if logger.isEnabledFor(logging.DEBUG): logger.debug("TRACE/REPORT/xml_report: hreference=%r (backmapped)", hreference) try: