Skip to content

Commit

Permalink
Fix wrong usage of os.path.join for remote URLS
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Mar 31, 2017
1 parent 4b3d771 commit 2ff234f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions datapackage/resource.py
Expand Up @@ -105,7 +105,7 @@ def remote_data_path(self):
if url:
return url
else:
path = self._absolute_path(self.descriptor.get('path'))
path = self._absolute_path(self.descriptor.get('path'), '/')
if path and _is_url(path):
return path

Expand Down Expand Up @@ -189,10 +189,14 @@ def _load_data(self):
if self._resource_file:
return self._resource_file.read()

def _absolute_path(self, path):
def _absolute_path(self, path, sep=None):
if path is None or self._base_path is None:
return path
return os.path.join(self._base_path, path)
if sep is None:
return os.path.join(self._base_path, path)
else:
return sep.join([self._base_path.rstrip(sep),
path.lstrip(sep)])


class TabularResource(Resource):
Expand Down

0 comments on commit 2ff234f

Please sign in to comment.