diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3825d..17eb45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +0.5.0 +----- + +* Add trailing slash to package directory links at the root index. Useful, for example, + with nginx proxy configurations, such as using the `ngx_aws_auth` module, where + directory paths can't be detected by the server. + 0.4.0 ----- diff --git a/pypiprivate/__init__.py b/pypiprivate/__init__.py index abeeedb..2b8877c 100644 --- a/pypiprivate/__init__.py +++ b/pypiprivate/__init__.py @@ -1 +1 @@ -__version__ = '0.4.0' +__version__ = '0.5.0' diff --git a/pypiprivate/storage.py b/pypiprivate/storage.py index ff5fe64..f743dac 100644 --- a/pypiprivate/storage.py +++ b/pypiprivate/storage.py @@ -53,11 +53,14 @@ def join_path(self, *args): def listdir(self, path): path = self.join_path(self.base_path, path) try: - return os.listdir(path) + entries = os.listdir(path) except OSError as e: if e.errno == errno.ENOENT: raise PathNotFound('Path {0} not found'.format(path)) raise e + return [ + ('{}/'.format(entry) if os.path.isdir(entry) else entry) + for entry in entries] def path_exists(self, path): path = self.join_path(self.base_path, path) @@ -150,7 +153,7 @@ def listdir(self, path): raise PathNotFound('Path {0} not found'.format(s3_prefix)) files = (c['Key'][len(s3_prefix):] for c in file_objs) files = [f for f in files if f != ''] - dirs = [cp['Prefix'][len(s3_prefix):].rstrip('/') for cp in dir_objs] + dirs = [cp['Prefix'][len(s3_prefix):] for cp in dir_objs] return files + dirs def path_exists(self, path): diff --git a/tox.ini b/tox.ini index 51210f8..c65dc40 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py34, py36 +envlist = py27, py34, py37 [testenv:py36] commands = pytest -v tests/