sharing/report,propfind: change from type bday to conversion

This commit is contained in:
Peter Bieringer
2026-03-24 12:22:14 +01:00
parent 65acbbc12a
commit 5038a70e9f
2 changed files with 11 additions and 11 deletions

View File

@@ -73,11 +73,11 @@ def xml_propfind(base_prefix: str, path: str,
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/PROPFIND/xml_propfind: shares=%r", shares)
for item, permission, sharetype in allowed_items:
for item, permission, conversion in allowed_items:
write = permission == "w"
multistatus.append(xml_propfind_response(
base_prefix, path, item, props, user, encoding, write=write,
allprop=allprop, propname=propname, max_resource_size=max_resource_size, shares=shares, sharetype=sharetype))
allprop=allprop, propname=propname, max_resource_size=max_resource_size, shares=shares, conversion=conversion))
return multistatus
@@ -85,7 +85,7 @@ def xml_propfind(base_prefix: str, path: str,
def xml_propfind_response(
base_prefix: str, path: str, item: types.CollectionOrItem,
props: Sequence[str], user: str, encoding: str, max_resource_size: int, write: bool = False,
propname: bool = False, allprop: bool = False, shares: dict = {}, sharetype: Union[str, None] = None) -> ET.Element:
propname: bool = False, allprop: bool = False, shares: dict = {}, conversion: Union[str, None] = None) -> ET.Element:
"""Build and return a PROPFIND response."""
if propname and allprop or (props and (propname or allprop)):
raise ValueError("Only use one of props, propname and allprops")
@@ -109,7 +109,7 @@ def xml_propfind_response(
# lookup share
share = None
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/PROPFIND/xml_propfind: sharetype=%r item.path=%r", sharetype, uri)
logger.debug("TRACE/PROPFIND/xml_propfind: conversion=%r item.path=%r", conversion, uri)
for entry in shares:
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/PROPFIND/xml_propfind: check entry=%r", entry)
@@ -117,7 +117,7 @@ def xml_propfind_response(
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/PROPFIND/xml_propfind: PathMapped=%r uri=%r", shares[entry]['PathMapped'], uri)
if uri.startswith(shares[entry]['PathMapped']):
if sharetype is not None and shares[entry]['ShareType'] == sharetype:
if conversion is not None and shares[entry]['Conversion'] == conversion:
share = shares[entry]
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/PROPFIND/xml_propfind: found share=%r", share)
@@ -549,7 +549,7 @@ class ApplicationPartPropfind(ApplicationBase):
if share['Conversion'] == "bday" and not isinstance(item, storage.BaseCollection):
if not item.convert_vcf_to_ics():
continue
allowed_items.append((item, permission, share['ShareType']))
allowed_items.append((item, permission, share['Conversion']))
else:
allowed_items.append((item, permission, None))
if self._sharing._enabled:
@@ -577,7 +577,7 @@ class ApplicationPartPropfind(ApplicationBase):
c_items_iter = iter(self._storage.discover(c_path, "0"))
c_allowed_items = list(self._collect_allowed_items(c_items_iter, c_user))
for item, permission in c_allowed_items:
allowed_items.append((item, permission, share['ShareType']))
allowed_items.append((item, permission, share['Conversion']))
shares[c_share] = share
headers = {"DAV": httputils.DAV_HEADERS,

View File

@@ -161,7 +161,7 @@ def xml_report(base_prefix: str, path: str, xml_request: Optional[ET.Element],
logger.debug("TRACE/REPORT/xml_report: base_prefix=%r path=%r", base_prefix, path)
share_bday_automap = False
if share and share['ShareType'] == "bday":
if share and share['Conversion'] == "bday":
share_bday_automap = True
if logger.isEnabledFor(logging.DEBUG):
logger.debug("TRACE/REPORT/xml_report(1): share=%r", share)
@@ -263,7 +263,7 @@ def xml_report(base_prefix: str, path: str, xml_request: Optional[ET.Element],
collection_tag = collection.tag
# !!! Don't access storage after this !!!
unlock_storage_fn()
if share and share['ShareType'] == "bday":
if share and share['Conversion'] == "bday":
collection_tag = "VCALENDAR"
# autoconvert
retrieved_items_vcf_to_ics = []
@@ -740,7 +740,7 @@ def xml_item_response(base_prefix: str, href: str,
logger.debug("TRACE/REPORT/xml_item_response: found=%s share=%r", found_item, share)
share_bday_automap = False
if share and share['ShareType'] == "bday":
if share and share['Conversion'] == "bday":
share_bday_automap = True
href_element = ET.Element(xmlutils.make_clark("D:href"))
@@ -793,7 +793,7 @@ def retrieve_items(
if share:
# map back to owner
hreference = hreference.replace(share['PathOrToken'], share['PathMapped'])
if share['ShareType'] == "bday":
if share['Conversion'] == "bday":
if not hreference.endswith('/'):
hreference = hreference.rstrip(".ics") + ".vcf"
try: