webdav: ';' in name not handled correctly [Bug 704444]
authorP. Christeas <p_christ@hol.gr>
Tue, 18 Jan 2011 16:50:21 +0000 (18:50 +0200)
committerP. Christeas <p_christ@hol.gr>
Tue, 18 Jan 2011 16:50:21 +0000 (18:50 +0200)
Reported by: Dr. Ferdinand Gassauer

Locations that contain a semicolon are split by the urlparse.urlparse(),
thus setting their 'path' and 'params' return fields (rather than just
the 'path'). In our syntax, there is no params, so the part after the
semicolon needs to be appended back to the patch.

bzr revid: p_christ@hol.gr-20110118165021-4knt76njdqnt1eln

addons/document_webdav/dav_fs.py
addons/document_webdav/webdav.py

index 22f50cb..8c606e4 100644 (file)
@@ -414,6 +414,8 @@ class openerp_dav_handler(dav_interface):
                                     # relative part, because ul is relative, anyway
                                     uparts=urlparse.urlparse(turi)
                                     turi=uparts[2]
+                                    if uparts[3]:
+                                        turi += ';' + uparts[3]
                                 if turi.startswith(ul):
                                     result.append( turi[len(self.parent.davpath):])
                                 else:
@@ -440,6 +442,8 @@ class openerp_dav_handler(dav_interface):
     def uri2local(self, uri):
         uparts=urlparse.urlparse(uri)
         reluri=uparts[2]
+        if uparts[3]:
+            reluri += ';'+uparts[3]
         if reluri and reluri[-1]=="/":
             reluri=reluri[:-1]
         return reluri
index 1b60ade..3a68fb0 100644 (file)
@@ -167,6 +167,8 @@ def mk_prop_response(self, uri, good_props, bad_props, doc):
     # write href information
     uparts=urlparse.urlparse(uri)
     fileloc=uparts[2]
+    if uparts[3]:
+        fileloc += ';' + uparts[3]
     if isinstance(fileloc, unicode):
         fileloc = fileloc.encode('utf-8')
     href=doc.createElement("D:href")
@@ -246,6 +248,8 @@ def mk_propname_response(self,uri,propnames,doc):
     # write href information
     uparts=urlparse.urlparse(uri)
     fileloc=uparts[2]
+    if uparts[3]:
+        fileloc += ';' + uparts[3]
     if isinstance(fileloc, unicode):
         fileloc = fileloc.encode('utf-8')
     href=doc.createElement("D:href")
@@ -303,6 +307,8 @@ def mk_lock_response(self, uri, props):
     # write href information
     uparts=urlparse.urlparse(uri)
     fileloc=uparts[2]
+    if uparts[3]:
+        fileloc += ';' + uparts[3]
     if isinstance(fileloc, unicode):
         fileloc = fileloc.encode('utf-8')
     davpath = self.parent.get_davpath()