Merge pull request #291 from jbalogh/delimiter

Folder results should include the delimiter.
This commit is contained in:
Steve Pulec 2015-01-29 22:49:09 -05:00
commit 06476ccb3a
3 changed files with 3 additions and 3 deletions

View File

@ -333,7 +333,7 @@ class S3Backend(BaseBackend):
for key_name, key in bucket.keys.items(): for key_name, key in bucket.keys.items():
if delimiter and delimiter in key_name: if delimiter and delimiter in key_name:
# If delimiter, we need to split out folder_results # If delimiter, we need to split out folder_results
folder_results.add(key_name.split(delimiter)[0]) folder_results.add(key_name.split(delimiter)[0] + delimiter)
else: else:
key_results.add(key) key_results.add(key)

View File

@ -496,7 +496,7 @@ def test_bucket_key_listing_order():
# Test delimiter with no prefix # Test delimiter with no prefix
delimiter = '/' delimiter = '/'
keys = [x.name for x in bucket.list(prefix=None, delimiter=delimiter)] keys = [x.name for x in bucket.list(prefix=None, delimiter=delimiter)]
keys.should.equal(['toplevel']) keys.should.equal(['toplevel/'])
delimiter = None delimiter = None
keys = [x.name for x in bucket.list(prefix + 'x', delimiter)] keys = [x.name for x in bucket.list(prefix + 'x', delimiter)]

View File

@ -272,7 +272,7 @@ def test_bucket_key_listing_order():
# Test delimiter with no prefix # Test delimiter with no prefix
delimiter = '/' delimiter = '/'
keys = [x.name for x in bucket.list(prefix=None, delimiter=delimiter)] keys = [x.name for x in bucket.list(prefix=None, delimiter=delimiter)]
keys.should.equal(['toplevel']) keys.should.equal(['toplevel/'])
delimiter = None delimiter = None
keys = [x.name for x in bucket.list(prefix + 'x', delimiter)] keys = [x.name for x in bucket.list(prefix + 'x', delimiter)]