Repository: jschneier/django-storages

Issue:
preload_metadata on s3boto3 backend
When `preload_metadata` is set to `True` on the s3boto3 backend boto3 complains about an "Unknown parameter in input"

```
Traceback (most recent call last):
  File "foo/env/bin/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "foo/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "foo/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "foo/env/lib/python3.4/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "foo/env/lib/python3.4/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "foo/env/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
    collected = self.collect()
  File "foo/env/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect
    handler(path, prefixed_path, storage)
  File "foo/env/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 305, in copy_file
    if not self.delete_file(path, prefixed_path, source_storage):
  File "foo/env/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 218, in delete_file
    if self.storage.exists(prefixed_path):
  File "foo/env/lib/python3.4/site-packages/storages/backends/s3boto3.py", line 479, in exists
    if self.entries:
  File "foo/env/lib/python3.4/site-packages/storages/backends/s3boto3.py", line 316, in entries
    for entry in self.bucket.objects.filter(prefix=self.location))
  File "foo/env/lib/python3.4/site-packages/storages/backends/s3boto3.py", line 315, in <genexpr>
    self._entries = dict((self._decode_name(entry.key), entry)
  File "foo/env/lib/python3.4/site-packages/boto3/resources/collection.py", line 83, in __iter__
    for page in self.pages():
  File "foo/env/lib/python3.4/site-packages/boto3/resources/collection.py", line 166, in pages
    for page in pages:
  File "foo/env/lib/python3.4/site-packages/botocore/paginate.py", line 102, in __iter__
    response = self._make_request(current_kwargs)
  File "foo/env/lib/python3.4/site-packages/botocore/paginate.py", line 174, in _make_request
    return self._method(**current_kwargs)
  File "foo/env/lib/python3.4/site-packages/botocore/client.py", line 159, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "foo/env/lib/python3.4/site-packages/botocore/client.py", line 470, in _make_api_call
    api_params, operation_model, context=request_context)
  File "foo/env/lib/python3.4/site-packages/botocore/client.py", line 523, in _convert_to_request_dict
    api_params, operation_model)
  File "foo/env/lib/python3.4/site-packages/botocore/validate.py", line 270, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "prefix", must be one of: Bucket, Delimiter, EncodingType, Marker, MaxKeys, Prefix
```

Looks like an easy enough fix, will submit a PR now that resolves the issue



Discussion:

Resolving patch:
diff --git a/storages/backends/s3boto3.py b/storages/backends/s3boto3.py
--- a/storages/backends/s3boto3.py
+++ b/storages/backends/s3boto3.py
@@ -313,7 +313,7 @@ def entries(self):
         """
         if self.preload_metadata and not self._entries:
             self._entries = dict((self._decode_name(entry.key), entry)
-                                 for entry in self.bucket.objects.filter(prefix=self.location))
+                                 for entry in self.bucket.objects.filter(Prefix=self.location))
         return self._entries
 
     def _get_access_keys(self):


Test patch: