Fix double slash in REPORT responses

When doing REPORTs with absolute paths as hrefs, the response hrefs
contain a double slash at the beginning. This breaks URL parsers and
makes them assume they have a URL without protocol of the format
`//example.com/foo/bar/`.
This commit is contained in:
Markus Unterwaditzer 2016-04-19 21:44:00 +02:00
parent bf8bd90bcb
commit 1b1ba421ff

View File

@ -565,7 +565,7 @@ def report(path, xml_request, collection):
# TODO: fix this # TODO: fix this
if hreference.split("/")[-1] == item.href: if hreference.split("/")[-1] == item.href:
# Happening when depth is 0 # Happening when depth is 0
uri = "/" + hreference uri = hreference
else: else:
# Happening when depth is 1 # Happening when depth is 1
uri = posixpath.join(hreference, item.href) uri = posixpath.join(hreference, item.href)