Skip to content

Commit

Permalink
use encryption setting for S3BotoStorageFile multipart uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
andersontep committed Nov 11, 2015
1 parent d2c38ba commit eed4bd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storages/backends/s3boto.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def write(self, content, *args, **kwargs):
self._multipart = self._storage.bucket.initiate_multipart_upload(
self.key.name,
headers=upload_headers,
reduced_redundancy=self._storage.reduced_redundancy
reduced_redundancy=self._storage.reduced_redundancy,
encrypt_key=self._storage.encryption,
)
if self.buffer_size <= self._buffer_file_size:
self._flush_write_buffer()
Expand Down
3 changes: 3 additions & 0 deletions tests/test_s3boto.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def test_storage_open_write(self):
name = 'test_open_for_writing.txt'
content = 'new content'

# Set the encryption flag used for multipart uploads
self.storage.encryption = True
# Set the ACL header used when creating/writing data.
self.storage.bucket.connection.provider.acl_header = 'x-amz-acl'
# Set the mocked key's bucket
Expand All @@ -183,6 +185,7 @@ def test_storage_open_write(self):
'x-amz-acl': 'public-read',
},
reduced_redundancy=self.storage.reduced_redundancy,
encrypt_key=True,
)

# Save the internal file before closing
Expand Down

0 comments on commit eed4bd1

Please sign in to comment.