From cf4a6ef7491c24627b654d4c3694a4c831db5811 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 13 Aug 2016 00:17:50 +0200 Subject: [PATCH 1/2] Revert 1ffc171f35bda370d8ef390dc8116b0e3eeea541 Maybe I misunderstand the RFC, but this properties are related to a principal collection. DAVdroid without preemptive authentication doesn't like this and tries to create calendars and addressbooks in /. --- radicale/xmlutils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index f195aeb..4515e19 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -577,7 +577,11 @@ def _propfind_response(path, item, props, user, write=False): tag = ET.Element(_tag("D", "href")) tag.text = _href(collection, "/") element.append(tag) - elif tag == _tag("D", "principal-URL") and collection.is_principal: + elif (tag in (_tag("C", "calendar-user-address-set"), + _tag("D", "principal-URL"), + _tag("CR", "addressbook-home-set"), + _tag("C", "calendar-home-set")) and + collection.is_principal): tag = ET.Element(_tag("D", "href")) tag.text = _href(collection, path) element.append(tag) @@ -595,11 +599,7 @@ def _propfind_response(path, item, props, user, write=False): element.append(comp) else: is404 = True - elif tag in ( - _tag("D", "current-user-principal"), - _tag("C", "calendar-user-address-set"), - _tag("CR", "addressbook-home-set"), - _tag("C", "calendar-home-set")): + elif tag == _tag("D", "current-user-principal"): tag = ET.Element(_tag("D", "href")) tag.text = _href(collection, ("/%s/" % user) if user else "/") element.append(tag) From c29fd1ca619604d118d063b1107208b15ebd0f5d Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 13 Aug 2016 00:19:14 +0200 Subject: [PATCH 2/2] Check that item is a collection --- radicale/xmlutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 4515e19..e92ff49 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -581,7 +581,7 @@ def _propfind_response(path, item, props, user, write=False): _tag("D", "principal-URL"), _tag("CR", "addressbook-home-set"), _tag("C", "calendar-home-set")) and - collection.is_principal): + collection.is_principal and is_collection): tag = ET.Element(_tag("D", "href")) tag.text = _href(collection, path) element.append(tag)