refactor: Simplify endpoint handling in S3 client initialization

This commit is contained in:
HynoR 2025-11-18 12:18:43 +08:00
parent 68dd9d608f
commit d060edab23
2 changed files with 2 additions and 3 deletions

View file

@ -46,8 +46,7 @@ func NewS3Client(vars map[string]interface{}) (*s3Client, error) {
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
o.UsePathStyle = mode == "path"
if endpoint != "" {
base := normalizeEndpoint(endpoint)
o.BaseEndpoint = aws.String(base)
o.BaseEndpoint = aws.String(normalizeEndpoint(endpoint))
}
})

View file

@ -44,7 +44,7 @@ func NewS3Client(vars map[string]interface{}) (*s3Client, error) {
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
o.UsePathStyle = mode == "path"
if endpoint != "" {
o.EndpointResolver = s3.EndpointResolverFromURL(normalizeEndpoint(endpoint))
o.BaseEndpoint = aws.String(normalizeEndpoint(endpoint))
}
})
return &s3Client{scType: scType, bucket: bucket, client: client}, nil