Skip to content

Commit

Permalink
fix: ensure encryption-config is passed to s3 upload-file (#461)
Browse files Browse the repository at this point in the history
* fix: ensure encryption-config is passed to s3 upload-file

* fix: tests
  • Loading branch information
as1729 authored Oct 1, 2024
1 parent 507d4b7 commit 9ed54ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion python/src/functions/create_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,10 @@ def create_archive(
upload_key = f"{target_key}report.zip"
# upload the zip file to the target key

s3_client.upload_file(file.name, S3_BUCKET, upload_key)
s3_client.upload_file(
file.name,
S3_BUCKET,
upload_key,
ExtraArgs={"ServerSideEncryption": "AES256"},
)
logger.info(f"Uploaded archive file to {upload_key}")
5 changes: 4 additions & 1 deletion python/tests/src/lib/test_create_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def test_create_archive_creates_zip():

# Assert that the file was attempted to be created
s3_client.upload_file.assert_called_with(
ANY, "test_bucket", "treasuryreports/1234/5678/report.zip"
ANY,
"test_bucket",
"treasuryreports/1234/5678/report.zip",
ExtraArgs={"ServerSideEncryption": "AES256"},
)


Expand Down

0 comments on commit 9ed54ee

Please sign in to comment.