From 3e284a5c3028513c0fc243e9c5d536fab64303d8 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:34:54 +0200 Subject: [PATCH 01/11] sharing/bday: fix backmapping of suffix --- radicale/app/propfind.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 77127274..1916a857 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -158,7 +158,7 @@ def xml_propfind_response( # backmap if uri.startswith(share['PathMapped']): uri = str(share['PathOrToken']) + uri.removeprefix(share['PathMapped']) - if share_bday_automap and not uri.endswith("/"): + if share_bday_automap and uri.endswith(".vcf"): uri = uri.rstrip(".vcf") + ".ics" href.text = xmlutils.make_href(base_prefix, uri) From b397c94ee59aac9cc95e4b4833e48282d45782dc Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:35:12 +0200 Subject: [PATCH 02/11] do not offer version on particular item (relates to https://github.com/Kozea/Radicale/pull/2116) --- radicale/app/propfind.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 1916a857..7c7ee449 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -168,7 +168,7 @@ def xml_propfind_response( props = [] # Should list all properties that can be retrieved by the code below props.append(xmlutils.make_clark("D:principal-collection-set")) - if user: + if user and is_collection: props.append(xmlutils.make_clark("RADICALE:version")) props.append(xmlutils.make_clark("D:current-user-principal")) props.append(xmlutils.make_clark("D:current-user-privilege-set")) From 14f0fa5fa44bf67bce94cb95cd56a07909c56481 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:37:11 +0200 Subject: [PATCH 03/11] propfind/sharing: fix support for single item request --- radicale/app/propfind.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 7c7ee449..32e9cbf4 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -226,7 +226,17 @@ def xml_propfind_response( is404 = False if tag == xmlutils.make_clark("D:getetag"): if not is_collection or is_leaf: - element.text = item.etag + if isinstance(item, storage.BaseCollection): + element.text = item.etag + else: + if share_bday_automap: + item_converted = item.convert_vcf_to_ics() + if item_converted: + element.text = item_converted.etag + else: + is404 = True + else: + element.text = item.etag else: is404 = True elif tag == xmlutils.make_clark("D:getlastmodified"): From db7800c3f6df14e6b63913622d76e08fa0690554 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:37:48 +0200 Subject: [PATCH 04/11] propfind: fix offering of C:supported-calendar-component-set --- radicale/app/propfind.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 32e9cbf4..ae816e4a 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -265,12 +265,14 @@ def xml_propfind_response( elif tag == xmlutils.make_clark("C:supported-calendar-component-set"): human_tag = xmlutils.make_human_tag(tag) if is_collection and is_leaf: - components_text = collection.get_meta(human_tag) - if components_text: - components = components_text.split(",") - else: - components = ["VTODO", "VEVENT", "VJOURNAL"] - if share_bday_automap: + components = [] + if collection.tag == "VCALENDAR": + components_text = collection.get_meta(human_tag) + if components_text: + components = components_text.split(",") + else: + components = ["VTODO", "VEVENT", "VJOURNAL"] + elif collection.tag == "VADDRESSBOOK" and share_bday_automap: # enforce VEVENT-only components = ["VEVENT"] for component in components: From 17d37cd3adce2ddbf34f7d1fd0f8e0ea37178417 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:38:14 +0200 Subject: [PATCH 05/11] propfind/sharing: fix support for single item request --- 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 ae816e4a..9407c0c4 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -372,15 +372,23 @@ def xml_propfind_response( element.append(supported_report) elif tag == xmlutils.make_clark("D:getcontentlength"): if not is_collection or is_leaf: - if collection.tag == "VADDRESSBOOK" and share_bday_automap and isinstance(item, storage.BaseCollection): - logger.trace("PROPFIND/xml_propfind_response/getcontentlength: start bday automap handling") - length = 0 - for entry in item.get_all(): - item_ics = entry.convert_vcf_to_ics() - if item_ics is None: - continue - length += len(item_ics.vobject_item.serialize().encode(encoding)) - element.text = str(length) + if collection.tag == "VADDRESSBOOK" and share_bday_automap: + if isinstance(item, storage.BaseCollection): + logger.trace("PROPFIND/xml_propfind_response/getcontentlength: start bday automap handling for collection") + length = 0 + for entry in item.get_all(): + item_ics = entry.convert_vcf_to_ics() + if item_ics is None: + continue + length += len(item_ics.vobject_item.serialize().encode(encoding)) + element.text = str(length) + else: + logger.trace("PROPFIND/xml_propfind_response/getcontentlength: start bday automap handling for single item") + item_converted = item.convert_vcf_to_ics() + if item_converted is not None: + element.text = str(len(item_converted.serialize())) + else: + is404 = True else: element.text = str(len(item.serialize().encode(encoding))) else: From 8ada1e84528603ea3ee756eb08ff85104c1776b4 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:38:47 +0200 Subject: [PATCH 06/11] sharing/bday: fix support of single item request --- radicale/app/propfind.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 9407c0c4..50e317a9 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -614,11 +614,17 @@ class ApplicationPartPropfind(ApplicationBase): return httputils.NOT_ALLOWED # put item back items_iter = itertools.chain([item], items_iter) - for item, permission, raw_permissions in list(self._collect_allowed_items(items_iter, user)): + item_list = list(self._collect_allowed_items(items_iter, user)) + len_item_list = len(item_list) + for item, permission, raw_permissions in item_list: if self._sharing._enabled and share: if share['Conversion'] == "bday" and not isinstance(item, storage.BaseCollection): if not item.convert_vcf_to_ics(): - continue + if len_item_list == 1: + # only dedicated item requested + return httputils.NOT_FOUND + else: + continue allowed_items.append((item, permission, raw_permissions, share['Conversion'])) else: allowed_items.append((item, permission, raw_permissions, None)) From 6b71716bdf622543c559c3ea23a9c962c680d208 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:39:17 +0200 Subject: [PATCH 07/11] propfind/sharing: extend trace log --- radicale/app/propfind.py | 1 + 1 file changed, 1 insertion(+) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 50e317a9..9424547c 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -589,6 +589,7 @@ class ApplicationPartPropfind(ApplicationBase): user = share['Owner'] permissions_filter = share['Permissions'] shares[share['PathOrToken']] = share + logger.trace("PROPFIND/shares: add mapping: PathOrToken=%r PathMapped=%r", share['PathOrToken'], share['PathMapped']) access = Access(self._rights, user, path, permissions_filter) if not access.check("r"): return httputils.NOT_ALLOWED From b4cab301e74905b7b11596383ab3d2cdcfe788d7 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:39:38 +0200 Subject: [PATCH 08/11] sharing: fix mapping of single item --- radicale/sharing/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radicale/sharing/__init__.py b/radicale/sharing/__init__.py index 109b292d..b1b1078e 100644 --- a/radicale/sharing/__init__.py +++ b/radicale/sharing/__init__.py @@ -500,7 +500,9 @@ class BaseSharing: if result['Conversion'] == "bday" and result['PathMapped'].endswith(".ics"): result['PathMapped'] = result['PathMapped'].removesuffix(".ics") + ".vcf" - logger.info("sharing/%s: resolved path %r->%r, user %r->%r, Permissions=%r Conversion=%r", "map", path, result['PathMapped'], user, result['Owner'], result['Permissions'], result['Conversion']) + result['PathOrToken'] = path + + logger.info("sharing/%s: resolved path %r->%r, user %r->%r, Permissions=%r Conversion=%r", "map", result['PathOrToken'], result['PathMapped'], user, result['Owner'], result['Permissions'], result['Conversion']) return result return None From e5add4c3b95d05b2a50be797e5f7f679f69bcf06 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:40:21 +0200 Subject: [PATCH 09/11] propfind/test: extend allprop test cases --- radicale/tests/test_base.py | 48 ++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/radicale/tests/test_base.py b/radicale/tests/test_base.py index 465d04b0..d3ee1a9a 100644 --- a/radicale/tests/test_base.py +++ b/radicale/tests/test_base.py @@ -905,7 +905,8 @@ permissions: RrWw""") status, prop = response["D:getetag"] assert status == 200 and not prop.text - def test_propfind_allprop(self) -> None: + def test_propfind_vcalendar_allprop(self) -> None: + self.configure({"logging": {"limit_content": 5000}}) self.mkcalendar("/calendar.ics/") event = get_file_content("event1.ics") self.put("/calendar.ics/event.ics", event) @@ -916,12 +917,57 @@ permissions: RrWw""") status, prop = response["D:sync-token"] assert status == 200 and prop.text assert "C:max-resource-size" not in response + assert "C:supported-calendar-component-set" in response + assert "CR:supported-address-data" not in response + assert "D:resourcetype" in response + status, resourcetype = response["D:resourcetype"] + resourcetypes = resourcetype.find(xmlutils.make_clark("C:calendar")) + assert resourcetypes is not None + assert "{urn:ietf:params:xml:ns:caldav}calendar" in resourcetypes.tag + assert "{urn:ietf:params:xml:ns:carddav}addressbook" not in resourcetypes.tag + status, sup_cal_comp_set = response["C:supported-calendar-component-set"] + sup_cal_comp_sets = sup_cal_comp_set.findall(xmlutils.make_clark("C:comp")) + comp_attr = [] + for comp in sup_cal_comp_sets: + comp_attr.append(comp.attrib) + logging.debug("comp: %r", comp.attrib) + assert {'name': 'VEVENT'} in comp_attr + assert {'name': 'VTODO'} in comp_attr + assert {'name': 'VJOURNAL'} in comp_attr _, responses = self.propfind("/calendar.ics/event.ics", propfind) response = responses["/calendar.ics/event.ics"] assert not isinstance(response, int) status, prop = response["D:getetag"] assert status == 200 and prop.text assert "C:max-resource-size" not in response + _, responses = self.propfind("/calendar.ics/event-not-exists.ics", propfind, check=404) + + def test_propfind_vaddressbook_allprop(self) -> None: + self.configure({"logging": {"limit_content": 5000}}) + self.create_addressbook("/addressbook.vcf/") + contact = get_file_content("contact1.vcf") + self.put("/addressbook.vcf/contact1.vcf", contact) + propfind = get_file_content("allprop.xml") + _, responses = self.propfind("/addressbook.vcf/", propfind) + response = responses["/addressbook.vcf/"] + assert not isinstance(response, int) + status, prop = response["D:sync-token"] + assert status == 200 and prop.text + assert "C:max-resource-size" not in response + assert "C:supported-calendar-component-set" not in response + assert "CR:supported-address-data" in response + assert "D:resourcetype" in response + status, resourcetype = response["D:resourcetype"] + resourcetypes = resourcetype.find(xmlutils.make_clark("CR:addressbook")) + assert resourcetypes is not None + assert "{urn:ietf:params:xml:ns:carddav}addressbook" in resourcetypes.tag + assert "{urn:ietf:params:xml:ns:caldav}calendar" not in resourcetypes.tag + _, responses = self.propfind("/addressbook.vcf/contact1.vcf", propfind) + response = responses["/addressbook.vcf/contact1.vcf"] + assert not isinstance(response, int) + status, prop = response["D:getetag"] + assert status == 200 and prop.text + assert "C:max-resource-size" not in response def test_propfind_nonexistent(self) -> None: """Read a property that does not exist.""" From db2f8585ba5830333300e003f31448ab735f4463 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:40:59 +0200 Subject: [PATCH 10/11] sharing/test: single item + allprop test cases --- radicale/tests/test_sharing.py | 48 ++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/radicale/tests/test_sharing.py b/radicale/tests/test_sharing.py index 9ec5b566..1ae9a294 100644 --- a/radicale/tests/test_sharing.py +++ b/radicale/tests/test_sharing.py @@ -86,14 +86,16 @@ class TestSharingApiSanity(BaseTest): _, headers, answer = self._sharing_api(sharing_type, action, check, login, data, content_type, accept, prefix=prefix) return _, headers, answer - def _propfind_allprop(self, path: str, login: str = "", prefix: Union[str, None] = None) -> dict: + def _propfind_allprop(self, path: str, login: str = "", prefix: Union[str, None] = None, check=207) -> dict: propfind_allprop = get_file_content("allprop.xml") if prefix is not None: path = prefix + path - _, responses = self.propfind(path=path, data=propfind_allprop, login=login, x_forwarded_for="127.0.0.2") + _, responses = self.propfind(path=path, data=propfind_allprop, login=login, x_forwarded_for="127.0.0.2", check=check) else: - _, responses = self.propfind(path=path, data=propfind_allprop, login=login) + _, responses = self.propfind(path=path, data=propfind_allprop, login=login, check=check) logging.info("response: %r", responses) + if check != 207: + return {} response = responses[path] assert not isinstance(response, int) return response @@ -4772,8 +4774,8 @@ permissions: RrWw""") assert row['ShareType'] == "map" assert row['Conversion'] == "bday" - # check PROPFIND item as user - logging.info("\n*** PROPFIND item as user -> calendar") + # check PROPFIND collection as user + logging.info("\n*** PROPFIND collection as user -> calendar") response = self._propfind_allprop(path_shared_r, login="user:userpw") logging.debug("response: %r", response) assert "CR:supported-address-data" not in response @@ -4781,8 +4783,18 @@ permissions: RrWw""") assert "C:supported-calendar-component-set" in response assert "D:current-user-privilege-set" in response - # check PROPFIND/privileges item as user - logging.info("\n*** PROPFIND/privileges item as user -> calendar") + logging.info("\n*** PROPFIND item as user -> calendar") + response = self._propfind_allprop(path_shared_r + "contact2-with-bday.ics", login="user:userpw") + logging.debug("response: %r", response) + assert "CR:supported-address-data" not in response + assert "D:sync-token" not in response + assert "D:current-user-privilege-set" in response + + logging.info("\n*** PROPFIND item as user with unsupported bday conversion -> not found") + response = self._propfind_allprop(path_shared_r + "contact1.ics", login="user:userpw", check=404) + + # check PROPFIND/privileges collection as user + logging.info("\n*** PROPFIND/privileges collection as user -> calendar") privileges_list = self._propfind_privileges(path_shared_r, login="user:userpw") assert "D:read" in privileges_list assert "D:write-content" not in privileges_list @@ -5168,6 +5180,12 @@ permissions: RrWw""") logging.debug("response %r: %r", path_mapped, response) assert "C:supported-calendar-component-set" in response assert path_shared not in responses + assert "D:resourcetype" in response + status, resourcetype = response["D:resourcetype"] + resourcetypes = resourcetype.find(xmlutils.make_clark("CR:addressbook")) + assert resourcetypes is not None + assert "{urn:ietf:params:xml:ns:carddav}addressbook" in resourcetypes.tag + assert "{urn:ietf:params:xml:ns:caldav}calendar" not in resourcetypes.tag # enable + unhide logging.info("\n*** enable+unhide bday owner to itself -> ok") @@ -5196,11 +5214,25 @@ permissions: RrWw""") """, login="owner:ownerpw", HTTP_DEPTH="1") # logging.debug("responses: %r", responses) - response = responses[path_mapped] + response = responses[path_shared] assert not isinstance(response, int) logging.debug("response %r: %r", path_mapped, response) assert "C:supported-calendar-component-set" in response assert path_shared in responses + status, resourcetype = response["D:resourcetype"] + resourcetypes = resourcetype.find(xmlutils.make_clark("C:calendar")) + assert resourcetypes is not None + assert "{urn:ietf:params:xml:ns:carddav}addressbook" not in resourcetypes.tag + assert "{urn:ietf:params:xml:ns:caldav}calendar" in resourcetypes.tag + status, sup_cal_comp_set = response["C:supported-calendar-component-set"] + sup_cal_comp_sets = sup_cal_comp_set.findall(xmlutils.make_clark("C:comp")) + comp_attr = [] + for comp in sup_cal_comp_sets: + comp_attr.append(comp.attrib) + logging.debug("comp: %r", comp.attrib) + assert {'name': 'VEVENT'} in comp_attr + assert {'name': 'VTODO'} not in comp_attr + assert {'name': 'VJOURNAL'} not in comp_attr # check PROPFIND item as owner logging.info("\n*** PROPFIND item as owner -> calendar") From 552fde3b35beb2b12722ec409edee5a8092c4b12 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:42:54 +0200 Subject: [PATCH 11/11] propfind/sharing: changelog for fixes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11b581b4..033913fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## 3.7.3.dev * Extension: expose RADICALE:version for authenticated users via PROPFIND * Fix: sharing: GET request on single item with bday conversion +* Fix: sharing: PROPFIND response on single item with bday conversion +* Fix: sharing: PROPFIND response related to C:supported-calendar-component-set ## 3.7.2 * Fix: broken storage/mtime granularity detection on vfat