fix: disable boto3 auto-checksums for S3-compatible endpoint support

boto3 1.36+ sends CRC32/CRC64 checksums by default on PUT requests.
S3-compatible stores like Hetzner Object Storage reject these with
BadRequest, breaking direct (non-delta) file uploads. This sets
request_checksum_calculation="when_required" to restore compatibility
while still working with AWS S3.

Also pins runtime deps to major version ranges and adds S3 compat tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Simone Scarduzio
2026-03-23 11:45:05 +01:00
parent 9bfe121f44
commit b0699f952a
4 changed files with 104 additions and 6 deletions
+8
View File
@@ -7,6 +7,7 @@ from pathlib import Path
from typing import TYPE_CHECKING, Any, BinaryIO, Optional
import boto3
from botocore.config import Config
from botocore.exceptions import ClientError
from ..ports.storage import ObjectHead, PutResult, StoragePort
@@ -42,6 +43,13 @@ class S3StorageAdapter(StoragePort):
client_params: dict[str, Any] = {
"service_name": "s3",
"endpoint_url": endpoint_url or os.environ.get("AWS_ENDPOINT_URL"),
# Disable automatic request checksums (CRC32/CRC64) added in
# boto3 1.36+. S3-compatible stores like Hetzner Object Storage
# reject the checksum headers with BadRequest.
"config": Config(
request_checksum_calculation="when_required",
response_checksum_validation="when_required",
),
}
# Merge in any additional boto3 kwargs (credentials, region, etc.)