Skip to content

Commit 1e3fbc8

Browse files
committed
fix: disable SHA256 verification in boto3
1 parent 8d8d84e commit 1e3fbc8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
`get_dcor_users_depot_path`
44
- BREAKING: `wait_for_resource` and `get_dc_instance` now only check S3 data
55
- feat: add `is_resource_private` method
6+
- fix: disable SHA256 verification in boto3 (not supported everywhere);
7+
note that we are still doing SHA256 verification after the upload
68
- enh: add "artifact" kwarg to `get_s3_dc_handle`
79
- enh: partial resource ID in basin names for `get_s3_dc_handle_basin_based`
810
- enh: add "perishable" key for basins in `get_s3_dc_handle_basin_based`

dcor_shared/s3.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import warnings
1212

1313
import boto3
14+
from botocore.config import Config
1415
import botocore.exceptions
1516

1617
from .ckan import get_ckan_config_option
@@ -305,6 +306,9 @@ def get_s3():
305306
use_ssl=ssl_verify,
306307
verify=ssl_verify,
307308
endpoint_url=get_ckan_config_option("dcor_object_store.endpoint_url"),
309+
# https://github.com/boto/boto3/issues/4400#issuecomment-2600742103
310+
config=Config(request_checksum_calculation="when_required",
311+
response_checksum_validation="when_required")
308312
)
309313
s3_resource = s3_session.resource(
310314
service_name="s3",
@@ -493,15 +497,15 @@ def upload_file(bucket_name, object_name, path, sha256=None, private=True,
493497

494498
path_size = pathlib.Path(path).stat().st_size
495499
s3_client, _, _ = get_s3()
496-
s3_bucket = require_bucket(bucket_name)
497500

498501
perform_upload = True
499502
if not override:
500503
perform_upload = not object_exists(bucket_name=bucket_name,
501504
object_name=object_name)
502505

503506
if perform_upload:
504-
s3_bucket.upload_file(Filename=str(path),
507+
s3_client.upload_file(Filename=str(path),
508+
Bucket=bucket_name,
505509
Key=object_name,
506510
# ExtraArgs={
507511
# # verification of the upload (breaks OpenStack)

0 commit comments

Comments
 (0)