From c65f9e5ba538f0aa0e16229656121a3cc783d82e Mon Sep 17 00:00:00 2001 From: Cody Neiman Date: Tue, 15 Nov 2022 12:19:19 +0000 Subject: [PATCH] Fix SSE-C extra_arg checks (#87) Fixes https://github.com/matrix-org/synapse-s3-storage-provider/issues/86 --- s3_storage_provider.py | 2 +- scripts/s3_media_upload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/s3_storage_provider.py b/s3_storage_provider.py index 547f29b..8047925 100644 --- a/s3_storage_provider.py +++ b/s3_storage_provider.py @@ -205,7 +205,7 @@ def s3_download_task(s3_client, bucket, key, extra_args, deferred, parent_logcon logger.info("Fetching %s from S3", key) try: - if extra_args["SSECustomerKey"] and extra_args["SSECustomerAlgorithm"]: + if "SSECustomerKey" in extra_args and "SSECustomerAlgorithm" in extra_args: resp = s3_client.get_object( Bucket=bucket, Key=key, diff --git a/scripts/s3_media_upload b/scripts/s3_media_upload index 07e83be..40a5772 100755 --- a/scripts/s3_media_upload +++ b/scripts/s3_media_upload @@ -171,7 +171,7 @@ def check_file_in_s3(s3, bucket, key, extra_args): """Check the file exists in S3 (though it could be different) """ try: - if extra_args["SSECustomerKey"] and extra_args["SSECustomerAlgorithm"]: + if "SSECustomerKey" in extra_args and "SSECustomerAlgorithm" in extra_args: s3.head_object( Bucket=bucket, Key=key,