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> </prop>
%s %s
</sync-collection>""" % sync_token_xml) </sync-collection>""" % sync_token_xml)
if sync_token and status == 412: if sync_token and status == 409:
return None, None return None, None
assert status == 207 assert status == 207
xml = ET.fromstring(answer) 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")): collection.get_meta("tag") not in ("VADDRESSBOOK", "VCALENDAR")):
logger.warning("Invalid REPORT method %r on %r requested", logger.warning("Invalid REPORT method %r on %r requested",
_tag_from_clark(root.tag), path) _tag_from_clark(root.tag), path)
return (client.PRECONDITION_FAILED, return (client.CONFLICT,
webdav_error("D", "supported-report")) webdav_error("D", "supported-report"))
prop_element = root.find(_tag("D", "prop")) prop_element = root.find(_tag("D", "prop"))
props = ( props = (
@ -1187,7 +1187,7 @@ def report(base_prefix, path, xml_request, collection):
# Invalid sync token # Invalid sync token
logger.warning("Client provided invalid sync token %r: %s", logger.warning("Client provided invalid sync token %r: %s",
old_sync_token, e, exc_info=True) old_sync_token, e, exc_info=True)
return (client.PRECONDITION_FAILED, return (client.CONFLICT,
webdav_error("D", "valid-sync-token")) webdav_error("D", "valid-sync-token"))
hreferences = ("/" + posixpath.join(collection.path, n) for n in names) hreferences = ("/" + posixpath.join(collection.path, n) for n in names)
# Append current sync token to response # Append current sync token to response