Return DAV:unauthenticated for DAV:current-user-principal when not logged in

This commit is contained in:
Unrud 2017-09-17 14:03:56 +02:00
parent 8551319682
commit f146be3d6c

View File

@ -927,9 +927,12 @@ def _propfind_response(base_prefix, path, item, props, user, write=False,
else:
is404 = True
elif tag == _tag("D", "current-user-principal"):
if user:
tag = ET.Element(_tag("D", "href"))
tag.text = _href(base_prefix, ("/%s/" % user) if user else "/")
tag.text = _href(base_prefix, "/%s/" % user)
element.append(tag)
else:
element.append(ET.Element(_tag("D", "unauthenticated")))
elif tag == _tag("D", "current-user-privilege-set"):
privileges = [("D", "read")]
if write: