From 2b1d3ce3d2cb8da92900ed534b91d5134a278648 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 6 Dec 2017 21:46:23 +0100 Subject: [PATCH] Check if REPORT method is supported on collection --- radicale/xmlutils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index eb313de..b096bcd 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -1140,6 +1140,16 @@ def report(base_prefix, path, xml_request, collection): logger.warning("Unsupported REPORT method %r on %r requested", _tag_from_clark(root.tag), path) return client.MULTI_STATUS, multistatus + if (root.tag == _tag("C", "calendar-multiget") and + collection.get_meta("tag") != "VCALENDAR" or + root.tag == _tag("CR", "addressbook-multiget") and + collection.get_meta("tag") != "VADDRESSBOOK" or + root.tag == _tag("D", "sync-collection") and + 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, + _webdav_error("D", "supported-report")) prop_element = root.find(_tag("D", "prop")) props = ( [prop.tag for prop in prop_element]