Skip to content

Commit

Permalink
Address incompatibility between boto3 >= 1.36.x and third-party S3-co…
Browse files Browse the repository at this point in the history
…mpatible storage providers (#718)
  • Loading branch information
lgarber-akamai authored Jan 30, 2025
1 parent 45db566 commit 634488f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions linodecli/plugins/obj/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

try:
import boto3
from botocore.config import Config
from botocore.exceptions import ClientError

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

# set this for later use
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _generate_test_file(

@pytest.fixture
def generate_test_files(
generate_test_file: Callable[[Optional[str], Optional[str]], Path]
generate_test_file: Callable[[Optional[str], Optional[str]], Path],
):
"""
Return a function that can generate files with random text.
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/image/test_plugin_image_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

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


Expand Down

0 comments on commit 634488f

Please sign in to comment.