sharing: bugfix on replacement

This commit is contained in:
Peter Bieringer
2026-03-24 18:22:12 +01:00
parent 8b8315ba93
commit eae5566865
2 changed files with 12 additions and 12 deletions

View File

@@ -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)

View File

@@ -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: