From e420859e28e950e2761829612816145b6e1232e9 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 1 Mar 2015 16:25:46 +0100 Subject: fix issues with special chars --- httpfs/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httpfs') diff --git a/httpfs/__init__.py b/httpfs/__init__.py index f0359e3..de4449c 100644 --- a/httpfs/__init__.py +++ b/httpfs/__init__.py @@ -29,7 +29,7 @@ class Path: self.initialized = False def buildUrl(self): - return self.parent.buildUrl() + "/" + quote(self.name) + return self.parent.buildUrl() + "/" + quote(self.name.encode('utf-8')) def getSession(self): return self.parent.getSession() @@ -39,6 +39,8 @@ class Path: @classmethod def fromPath(clazz, parent, pathElement): + if type(pathElement) == bytes: + pathElement = pathElement.decode('utf-8') p = clazz(parent, unquote(pathElement)) logging.info("created {} '{}' referencing {}".format( clazz.__name__, p.name, p.buildUrl())) @@ -99,7 +101,7 @@ class Directory(Path): self.entries = {} def init(self): - url = self.buildUrl() + url = self.buildUrl() + "/" logging.info("Directory url={} name={}".format(url, self.name)) r = self.getSession().get(url, stream=True, timeout=Config.timeout) if r.status_code != 200: -- cgit v1.2.1