Skip to content

Commit 18d32f9

Browse files
authored
Merge pull request #298 from databacker/fix-aws-put-error
set s3 endpoint resolver only if it is non-blank
2 parents e6fecf8 + d6f27a5 commit 18d32f9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pkg/storage/s3/s3.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,16 @@ func (s *S3) Remove(target string) error {
179179

180180
func (s *S3) getClient() (*s3.Client, error) {
181181
// Get the AWS config
182-
cleanEndpoint := getEndpoint(s.endpoint)
183-
opts := []func(*config.LoadOptions) error{
184-
config.WithEndpointResolverWithOptions(
185-
aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
186-
return aws.Endpoint{URL: cleanEndpoint}, nil
187-
}),
188-
),
182+
var opts []func(*config.LoadOptions) error
183+
if s.endpoint != "" {
184+
cleanEndpoint := getEndpoint(s.endpoint)
185+
opts = append(opts,
186+
config.WithEndpointResolverWithOptions(
187+
aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
188+
return aws.Endpoint{URL: cleanEndpoint}, nil
189+
}),
190+
),
191+
)
189192
}
190193
if log.IsLevelEnabled(log.TraceLevel) {
191194
opts = append(opts, config.WithClientLogMode(aws.LogRequestWithBody|aws.LogResponse))

0 commit comments

Comments
 (0)