mirror of
https://github.com/usememos/memos.git
synced 2025-10-06 20:36:44 +08:00
fix: remove ACL when set URLPrefix (#2532)
This commit is contained in:
parent
d317b03832
commit
e016244aba
1 changed files with 7 additions and 3 deletions
|
@ -64,13 +64,17 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
|
||||||
|
|
||||||
func (client *Client) UploadFile(ctx context.Context, filename string, fileType string, src io.Reader) (string, error) {
|
func (client *Client) UploadFile(ctx context.Context, filename string, fileType string, src io.Reader) (string, error) {
|
||||||
uploader := manager.NewUploader(client.Client)
|
uploader := manager.NewUploader(client.Client)
|
||||||
uploadOutput, err := uploader.Upload(ctx, &awss3.PutObjectInput{
|
// set ACL according to if user set prefix
|
||||||
|
obj := awss3.PutObjectInput{
|
||||||
Bucket: aws.String(client.Config.Bucket),
|
Bucket: aws.String(client.Config.Bucket),
|
||||||
Key: aws.String(filename),
|
Key: aws.String(filename),
|
||||||
Body: src,
|
Body: src,
|
||||||
ContentType: aws.String(fileType),
|
ContentType: aws.String(fileType),
|
||||||
ACL: types.ObjectCannedACL(*aws.String("public-read")),
|
}
|
||||||
})
|
if client.Config.URLPrefix == "" {
|
||||||
|
obj.ACL = types.ObjectCannedACL(*aws.String("public-read"))
|
||||||
|
}
|
||||||
|
uploadOutput, err := uploader.Upload(ctx, &obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue