fix(oss): 禁用OSS S3兼容API的自动校验和计算,以防止签名不匹配
This commit is contained in:
@@ -39,6 +39,10 @@ func newOSSClient(endpoint, region, accessKey, secretKey string) (*s3.Client, er
|
||||
cfg, err := config.LoadDefaultConfig(context.Background(),
|
||||
config.WithRegion(region),
|
||||
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, "")),
|
||||
// OSS S3-compatible API does not support AWS-specific checksum headers.
|
||||
// Disable automatic checksum calculation/validation to prevent signature mismatch (403).
|
||||
config.WithRequestChecksumCalculation(aws.RequestChecksumCalculationWhenRequired),
|
||||
config.WithResponseChecksumValidation(aws.ResponseChecksumValidationWhenRequired),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load AWS config: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user