Parcourir la source

fix: ensure BaseEndpoint is set only when a valid endpoint is provided

Yeuoly il y a 6 mois
Parent
commit
ad780b202a
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      internal/oss/s3/s3_storage.go

+ 4 - 2
internal/oss/s3/s3_storage.go

@@ -47,7 +47,9 @@ func NewS3Storage(useAws bool, endpoint string, usePathStyle bool, ak string, sk
 		}
 
 		client = s3.NewFromConfig(cfg, func(options *s3.Options) {
-			options.BaseEndpoint = aws.String(endpoint)
+			if endpoint != "" {
+				options.BaseEndpoint = aws.String(endpoint)
+			}
 		})
 	} else {
 		client = s3.New(s3.Options{
@@ -179,4 +181,4 @@ func (s *S3Storage) State(key string) (oss.OSSState, error) {
 
 func (s *S3Storage) Type() string {
 	return oss.OSS_TYPE_S3
-}
+}