🎨 use S3ForcePathStyle

pull/548/head
微凉 2022-01-03 22:37:26 +08:00
parent 84fc0ab1bd
commit c22ff77c89
1 changed files with 5 additions and 4 deletions

View File

@ -308,9 +308,10 @@ func (driver Pan123) Upload(file *model.FileStream, account *model.Account) erro
return err return err
} }
cfg := &aws.Config{ cfg := &aws.Config{
Credentials: credentials.NewStaticCredentials(resp.Data.AccessKeyId, resp.Data.SecretAccessKey, resp.Data.SessionToken), Credentials: credentials.NewStaticCredentials(resp.Data.AccessKeyId, resp.Data.SecretAccessKey, resp.Data.SessionToken),
Region: aws.String("123pan"), Region: aws.String("123pan"),
Endpoint: aws.String("123pan.com/" + resp.Data.Bucket), Endpoint: aws.String("file.123pan.com"),
S3ForcePathStyle: aws.Bool(true),
} }
s, err := session.NewSession(cfg) s, err := session.NewSession(cfg)
if err != nil { if err != nil {
@ -318,7 +319,7 @@ func (driver Pan123) Upload(file *model.FileStream, account *model.Account) erro
} }
uploader := s3manager.NewUploader(s) uploader := s3manager.NewUploader(s)
input := &s3manager.UploadInput{ input := &s3manager.UploadInput{
Bucket: aws.String("file"), Bucket: &resp.Data.Bucket,
Key: &resp.Data.Key, Key: &resp.Data.Key,
Body: file, Body: file,
} }