matrix-org / synapse-s3-storage-provider

Synapse storage provider to fetch and store media in Amazon S3
Apache License 2.0
118 stars 33 forks source link

KeyError: 'SSECustomerKey' #86

Closed jcalonso closed 1 year ago

jcalonso commented 1 year ago

There is a bug introduced in #84

Specifically this line: https://github.com/matrix-org/synapse-s3-storage-provider/pull/84/files#diff-65309baef1ac00a6facf27b1c1cb2ea43191a7c7000d4062340e5340ffc9d554R174

This line is producing an error when no SSECustomerKey is provided.

Should this be instead:

if "SSECustomerKey" in extra_args and "SSECustomerAlgorithm" in extra_args:

Error:

root@synapse:/synapse-s3-storage-provider/scripts# s3_media_upload upload /data/media_storage mybucket
  0%|                                                                                                                         | 0/113 [00:00<?, ?files/s]
Traceback (most recent call last):
  File "/usr/local/bin/s3_media_upload", line 579, in <module>
    main()
  File "/usr/local/bin/s3_media_upload", line 565, in main
    run_upload(
  File "/usr/local/bin/s3_media_upload", line 338, in run_upload
    if not check_file_in_s3(s3, bucket, rel_file_path, extra_args):
  File "/usr/local/bin/s3_media_upload", line 174, in check_file_in_s3
    if extra_args["SSECustomerKey"] and extra_args["SSECustomerAlgorithm"]:
KeyError: 'SSECustomerKey'
jcalonso commented 1 year ago

cc @xangelix

xangelix commented 1 year ago

My apologies, I must have tested the wrong branch when looking at SSE-C disabled. Should be fixed in https://github.com/matrix-org/synapse-s3-storage-provider/pull/87.

jcalonso commented 1 year ago

My apologies, I must have tested the wrong branch when looking at SSE-C disabled. Should be fixed in #87.

Thanks for the quick fix. Let hope it gets merged soon :)