From 17d37cd3adce2ddbf34f7d1fd0f8e0ea37178417 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 4 May 2026 21:38:14 +0200 Subject: [PATCH] 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: