Use correct HTTP status for WebDAV precondition

This commit is contained in:
Unrud 2018-05-04 22:12:30 +02:00
parent a6b1219ba5
commit f815f1be7f
2 changed files with 3 additions and 3 deletions

View File

@ -1155,7 +1155,7 @@ class BaseRequestsMixIn:
</prop>
%s
</sync-collection>""" % sync_token_xml)
if sync_token and status == 412:
if sync_token and status == 409:
return None, None
assert status == 207
xml = ET.fromstring(answer)

View File

@ -1155,7 +1155,7 @@ def report(base_prefix, path, xml_request, collection):
collection.get_meta("tag") not in ("VADDRESSBOOK", "VCALENDAR")):
logger.warning("Invalid REPORT method %r on %r requested",
_tag_from_clark(root.tag), path)
return (client.PRECONDITION_FAILED,
return (client.CONFLICT,
webdav_error("D", "supported-report"))
prop_element = root.find(_tag("D", "prop"))
props = (
@ -1187,7 +1187,7 @@ def report(base_prefix, path, xml_request, collection):
# Invalid sync token
logger.warning("Client provided invalid sync token %r: %s",
old_sync_token, e, exc_info=True)
return (client.PRECONDITION_FAILED,
return (client.CONFLICT,
webdav_error("D", "valid-sync-token"))
hreferences = ("/" + posixpath.join(collection.path, n) for n in names)
# Append current sync token to response