Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix url if WebDav path containing not escaped characters #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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