Skip to content

Conversation

@ffoxin
Copy link

@ffoxin ffoxin commented Mar 23, 2015

It is necessary to escape WebDav path before requesting it.

Server path can contain some charaters that should be escaped in url (i.e. space character).

@hashbackup
Copy link

I believe two other spots need this:

@@ -83,7 +84,7 @@
             port = 443 if protocol == 'https' else 80
         self.baseurl = '{0}://{1}:{2}'.format(protocol, host, port)
         if path:
-            self.baseurl = '{0}/{1}'.format(self.baseurl, path)
+            self.baseurl = '{0}/{1}'.format(self.baseurl, quote(path))
         self.cwd = '/'
         self.session = requests.session()
         self.session.verify = verify_ssl
@@ -114,10 +115,10 @@
         return response
 
     def _get_url(self, path):
-        path = str(path).strip()
+        path = quote(str(path).strip())
         if path.startswith('/'):
             return self.baseurl + path
-        return "".join((self.baseurl, self.cwd, path))
+        return "".join((self.baseurl, quote(self.cwd), path))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants