From 90486f33a59b4e8b0407ab64f9aeff02ef6b3f68 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 4 Sep 2016 20:21:23 +0200 Subject: [PATCH] Log invalid URLs in XML requests Before the requests either failed or the invalid hreference was silently dropped. --- radicale/xmlutils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index b0c5b92..c9b1289 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -774,6 +774,9 @@ def report(base_prefix, path, xml_request, collection): unquote(urlparse(href_element.text).path)) if (href_path + "/").startswith(base_prefix + "/"): hreferences.add(href_path[len(base_prefix):]) + else: + collection.logger.info( + "Skipping invalid path: %s", href_path) else: hreferences = (path,) filters = ( @@ -785,7 +788,14 @@ def report(base_prefix, path, xml_request, collection): multistatus = ET.Element(_tag("D", "multistatus")) for hreference in hreferences: - name = name_from_path(hreference, collection) + try: + name = name_from_path(hreference, collection) + except ValueError: + collection.logger.info("Skipping invalid path: %s", hreference) + response = _item_response(base_prefix, hreference, + found_item=False) + multistatus.append(response) + continue if name: # Reference is an item item = collection.get(name)