propfind/sharing: fix support for single item request
This commit is contained in:
@@ -372,15 +372,23 @@ def xml_propfind_response(
|
|||||||
element.append(supported_report)
|
element.append(supported_report)
|
||||||
elif tag == xmlutils.make_clark("D:getcontentlength"):
|
elif tag == xmlutils.make_clark("D:getcontentlength"):
|
||||||
if not is_collection or is_leaf:
|
if not is_collection or is_leaf:
|
||||||
if collection.tag == "VADDRESSBOOK" and share_bday_automap and isinstance(item, storage.BaseCollection):
|
if collection.tag == "VADDRESSBOOK" and share_bday_automap:
|
||||||
logger.trace("PROPFIND/xml_propfind_response/getcontentlength: start bday automap handling")
|
if isinstance(item, storage.BaseCollection):
|
||||||
length = 0
|
logger.trace("PROPFIND/xml_propfind_response/getcontentlength: start bday automap handling for collection")
|
||||||
for entry in item.get_all():
|
length = 0
|
||||||
item_ics = entry.convert_vcf_to_ics()
|
for entry in item.get_all():
|
||||||
if item_ics is None:
|
item_ics = entry.convert_vcf_to_ics()
|
||||||
continue
|
if item_ics is None:
|
||||||
length += len(item_ics.vobject_item.serialize().encode(encoding))
|
continue
|
||||||
element.text = str(length)
|
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:
|
else:
|
||||||
element.text = str(len(item.serialize().encode(encoding)))
|
element.text = str(len(item.serialize().encode(encoding)))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user