Skip to content

Commit 634488f

Browse files
Address incompatibility between boto3 >= 1.36.x and third-party S3-compatible storage providers (#718)
1 parent 45db566 commit 634488f

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

linodecli/plugins/obj/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
try:
5858
import boto3
59+
from botocore.config import Config
5960
from botocore.exceptions import ClientError
6061

6162
HAS_BOTO = True
@@ -443,6 +444,16 @@ def _get_boto_client(cluster, access_key, secret_key):
443444
aws_secret_access_key=secret_key,
444445
region_name=cluster,
445446
endpoint_url=BASE_URL_TEMPLATE.format(cluster),
447+
config=Config(
448+
# This addresses an incompatibility between boto3 1.36.x and
449+
# some third-party S3-compatible storage platforms.
450+
# In the future we may want to consider manually computing the
451+
# CRC32 hash of a file before uploading it.
452+
#
453+
# See: https://github.com/boto/boto3/issues/4398#issuecomment-2619946229
454+
request_checksum_calculation="when_required",
455+
response_checksum_validation="when_required",
456+
),
446457
)
447458

448459
# set this for later use

tests/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def _generate_test_file(
186186

187187
@pytest.fixture
188188
def generate_test_files(
189-
generate_test_file: Callable[[Optional[str], Optional[str]], Path]
189+
generate_test_file: Callable[[Optional[str], Optional[str]], Path],
190190
):
191191
"""
192192
Return a function that can generate files with random text.

tests/integration/image/test_plugin_image_upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
# A minimal gzipped image that will be accepted by the API
2121
TEST_IMAGE_CONTENT = (
22-
b"\x1F\x8B\x08\x08\xBD\x5C\x91\x60\x00\x03\x74\x65\x73\x74\x2E\x69"
23-
b"\x6D\x67\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"
22+
b"\x1f\x8b\x08\x08\xbd\x5c\x91\x60\x00\x03\x74\x65\x73\x74\x2e\x69"
23+
b"\x6d\x67\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2424
)
2525

2626

0 commit comments

Comments
 (0)