From f815f1be7fa192d8545cbe9a36c281e3bb2452b1 Mon Sep 17 00:00:00 2001 From: Unrud Date: Fri, 4 May 2018 22:12:30 +0200 Subject: [PATCH] Use correct HTTP status for WebDAV precondition --- radicale/tests/test_base.py | 2 +- radicale/xmlutils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/radicale/tests/test_base.py b/radicale/tests/test_base.py index 7fff7ca..1d3941c 100644 --- a/radicale/tests/test_base.py +++ b/radicale/tests/test_base.py @@ -1155,7 +1155,7 @@ class BaseRequestsMixIn: %s """ % 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) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 5cc0181..2d311e3 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -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