Fix SSE-C extra_arg checks (#87)

Fixes https://github.com/matrix-org/synapse-s3-storage-provider/issues/86
This commit is contained in:
Cody Neiman 2022-11-15 12:19:19 +00:00 committed by GitHub
parent 52be2ef613
commit c65f9e5ba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -205,7 +205,7 @@ def s3_download_task(s3_client, bucket, key, extra_args, deferred, parent_logcon
logger.info("Fetching %s from S3", key) logger.info("Fetching %s from S3", key)
try: try:
if extra_args["SSECustomerKey"] and extra_args["SSECustomerAlgorithm"]: if "SSECustomerKey" in extra_args and "SSECustomerAlgorithm" in extra_args:
resp = s3_client.get_object( resp = s3_client.get_object(
Bucket=bucket, Bucket=bucket,
Key=key, Key=key,

View file

@ -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) """Check the file exists in S3 (though it could be different)
""" """
try: try:
if extra_args["SSECustomerKey"] and extra_args["SSECustomerAlgorithm"]: if "SSECustomerKey" in extra_args and "SSECustomerAlgorithm" in extra_args:
s3.head_object( s3.head_object(
Bucket=bucket, Bucket=bucket,
Key=key, Key=key,