From 29e03840b99e6c42a47eed82fa3cc119646a5e4a Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 15 Mar 2026 11:06:52 +0100 Subject: [PATCH] sharing/bday: add support for contentlength+size --- radicale/app/propfind.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/radicale/app/propfind.py b/radicale/app/propfind.py index 15d90993..af4b5e58 100644 --- a/radicale/app/propfind.py +++ b/radicale/app/propfind.py @@ -305,7 +305,18 @@ def xml_propfind_response( element.append(supported_report) elif tag == xmlutils.make_clark("D:getcontentlength"): if not is_collection or is_leaf: - element.text = str(len(item.serialize().encode(encoding))) + if collection.tag == "VADDRESSBOOK" and share_bday_automap: + if logger.isEnabledFor(logging.DEBUG): + logger.debug("TRACE/PROPFIND/xml_propfind_response/getcontentcount: 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) + else: + element.text = str(len(item.serialize().encode(encoding))) else: is404 = True elif tag == xmlutils.make_clark("D:owner"): @@ -362,7 +373,18 @@ def xml_propfind_response( elif tag == xmlutils.make_clark("RADICALE:getcontentcount"): # Only for internal use by the web interface if isinstance(item, storage.BaseCollection) and not collection.is_principal: - element.text = str(sum(1 for x in item.get_all())) + if collection.tag == "VADDRESSBOOK" and share_bday_automap: + if logger.isEnabledFor(logging.DEBUG): + logger.debug("TRACE/PROPFIND/xml_propfind_response/getcontentcount: start bday automap handling") + items = [] + for entry in item.get_all(): + item_ics = entry.convert_vcf_to_ics() + if item_ics is None: + continue + items.append(item_ics.vobject_item) + element.text = str(sum(1 for x in items)) + else: + element.text = str(sum(1 for x in item.get_all())) else: is404 = True elif tag == xmlutils.make_clark("D:displayname"):