fix(worker): disable SDK checksum trailer for R2 uploads
AWS SDK Go v2 s3 v1.100.0 defaults to RequestChecksumCalculationWhenSupported, which causes PutObject to send STREAMING-UNSIGNED-PAYLOAD-TRAILER — a chunked transfer mode R2 doesn't support. Setting WhenRequired makes the SDK send a standard signed payload instead, resolving the 403 SignatureDoesNotMatch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dc0caf0115
commit
341591a10b
1 changed files with 5 additions and 0 deletions
|
|
@ -36,6 +36,11 @@ func NewR2Client(cfg *Config) *B2Client {
|
|||
client := s3.NewFromConfig(awsCfg, func(o *s3.Options) {
|
||||
o.BaseEndpoint = aws.String(cfg.R2Endpoint)
|
||||
o.UsePathStyle = true
|
||||
// R2 rejects STREAMING-UNSIGNED-PAYLOAD-TRAILER (SDK default for PutObject).
|
||||
// WhenRequired disables automatic checksum calculation so the SDK sends a
|
||||
// standard signed payload instead.
|
||||
o.RequestChecksumCalculation = aws.RequestChecksumCalculationWhenRequired
|
||||
o.ResponseChecksumValidation = aws.ResponseChecksumValidationWhenRequired
|
||||
})
|
||||
|
||||
return &B2Client{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue