summaryrefslogtreecommitdiff
path: root/addons/document_webdav/webdav.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-10-14 15:51:18 +0300
committerP. Christeas <p_christ@hol.gr>2010-10-14 15:51:18 +0300
commitb275fc4601263e58def6d8ff29088e18a6a6b09d (patch)
treed3e927023ad010343875d57dba517f3aec9c3fcb /addons/document_webdav/webdav.py
parent1e0daa78447147bc5b6b78f3f1bdfc311781b87f (diff)
Doc Webdav: reply with relative URIs when the request was relative.
If the DAV client requests properties for a relative URI (without the protocol:ip:port part), it means it can also understand responses with relative notation, so don't bother calculating the prefix (non-trivial). This fixes the REPORT responses to Mozilla Sunbird. bzr revid: p_christ@hol.gr-20101014125118-3x5ivmrbaqwb1nsx
Diffstat (limited to 'addons/document_webdav/webdav.py')
-rw-r--r--addons/document_webdav/webdav.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/document_webdav/webdav.py b/addons/document_webdav/webdav.py
index 484a1054475..bb2b8caf470 100644
--- a/addons/document_webdav/webdav.py
+++ b/addons/document_webdav/webdav.py
@@ -152,7 +152,12 @@ def mk_prop_response(self, uri, good_props, bad_props, doc):
fileloc = fileloc.encode('utf-8')
href=doc.createElement("D:href")
davpath = self._dataclass.parent.get_davpath()
- hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
+ if uparts[0] and uparts[1]:
+ hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
+ else:
+ # When the request has been relative, we don't have enough data to
+ # reply with absolute url here.
+ hurl = '%s%s' % (davpath, urllib.quote(fileloc))
huri=doc.createTextNode(hurl)
href.appendChild(huri)
re.appendChild(href)
@@ -226,7 +231,12 @@ def mk_propname_response(self,uri,propnames,doc):
fileloc = fileloc.encode('utf-8')
href=doc.createElement("D:href")
davpath = self._dataclass.parent.get_davpath()
- hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
+ if uparts[0] and uparts[1]:
+ hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
+ else:
+ # When the request has been relative, we don't have enough data to
+ # reply with absolute url here.
+ hurl = '%s%s' % (davpath, urllib.quote(fileloc))
huri=doc.createTextNode(hurl)
href.appendChild(huri)
re.appendChild(href)