Skip to content

Commit

Permalink
S3Boto3: Replace list_objects_v2 with list_objects in .listdir()
Browse files Browse the repository at this point in the history
This restores compatibility with other services implementing the S3
protocol that do not yet support the new method.

Closes #586
  • Loading branch information
jschneier committed Sep 6, 2018
1 parent 96d4268 commit c383574
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ django-storages CHANGELOG
******************

- Fix off-by-1 error in ``get_available_name`` whenever ``file_overwrite`` or ``overwrite_files`` is ``True`` (`#588`_, `#589`_)
- Change ``S3Boto3Storage.listdir()`` to use ``list_objects`` instead of ``list_objects_v2`` to restore
compatibility with services implementing the S3 protocol that do not yet support the new method (`#586`_, `#590`_)

.. _#588: https://github.com/jschneier/django-storages/issues/588
.. _#589: https://github.com/jschneier/django-storages/pull/589
.. _#586: https://github.com/jschneier/django-storages/issues/586
.. _#590: https://github.com/jschneier/django-storages/pull/590

1.7 (2018-09-03)
****************
Expand Down
2 changes: 1 addition & 1 deletion storages/backends/s3boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def listdir(self, name):

directories = []
files = []
paginator = self.connection.meta.client.get_paginator('list_objects_v2')
paginator = self.connection.meta.client.get_paginator('list_objects')
pages = paginator.paginate(Bucket=self.bucket_name, Delimiter='/', Prefix=path)
for page in pages:
for entry in page.get('CommonPrefixes', ()):
Expand Down

0 comments on commit c383574

Please sign in to comment.