sharing: fix get request on single items with bday conversion
This commit is contained in:
@@ -121,7 +121,10 @@ class ApplicationPartGet(ApplicationBase):
|
|||||||
elif limited_access:
|
elif limited_access:
|
||||||
return httputils.NOT_ALLOWED
|
return httputils.NOT_ALLOWED
|
||||||
else:
|
else:
|
||||||
content_type = xmlutils.OBJECT_MIMETYPES[item.name]
|
if share and share['Conversion'] == "bday":
|
||||||
|
content_type = xmlutils.MIMETYPES["VCALENDAR"]
|
||||||
|
else:
|
||||||
|
content_type = xmlutils.OBJECT_MIMETYPES[item.name]
|
||||||
content_disposition = ""
|
content_disposition = ""
|
||||||
assert item.last_modified
|
assert item.last_modified
|
||||||
headers = {
|
headers = {
|
||||||
@@ -130,9 +133,12 @@ class ApplicationPartGet(ApplicationBase):
|
|||||||
"ETag": item.etag}
|
"ETag": item.etag}
|
||||||
if content_disposition:
|
if content_disposition:
|
||||||
headers["Content-Disposition"] = content_disposition
|
headers["Content-Disposition"] = content_disposition
|
||||||
if isinstance(item, storage.BaseCollection) and share and share['Conversion'] == "bday":
|
if share and share['Conversion'] == "bday":
|
||||||
# convert VCF to ICS
|
if isinstance(item, storage.BaseCollection):
|
||||||
answer = item.serialize(vcf_to_ics=True)
|
# convert VCF to ICS
|
||||||
|
answer = item.serialize(vcf_to_ics=True)
|
||||||
|
else:
|
||||||
|
answer = item.convert_vcf_to_ics().serialize()
|
||||||
else:
|
else:
|
||||||
answer = item.serialize()
|
answer = item.serialize()
|
||||||
return client.OK, headers, answer, None
|
return client.OK, headers, answer, None
|
||||||
|
|||||||
@@ -497,6 +497,9 @@ class BaseSharing:
|
|||||||
logger.info("sharing/%s: resolved path %r->%r, user %r->%r not enabled by user", "map", path, result['PathMapped'], user, result['Owner'])
|
logger.info("sharing/%s: resolved path %r->%r, user %r->%r not enabled by user", "map", path, result['PathMapped'], user, result['Owner'])
|
||||||
return {'error': 'map-not-enabled'}
|
return {'error': 'map-not-enabled'}
|
||||||
|
|
||||||
|
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'])
|
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'])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user