Commit 436eb0e5 authored by Steven's avatar Steven

chore: tweak s3 comments

parent e016244a
...@@ -64,17 +64,17 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) { ...@@ -64,17 +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)
// set ACL according to if user set prefix putInput := awss3.PutObjectInput{
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),
} }
// Set ACL according to if url prefix is set.
if client.Config.URLPrefix == "" { if client.Config.URLPrefix == "" {
obj.ACL = types.ObjectCannedACL(*aws.String("public-read")) putInput.ACL = types.ObjectCannedACL(*aws.String("public-read"))
} }
uploadOutput, err := uploader.Upload(ctx, &obj) uploadOutput, err := uploader.Upload(ctx, &putInput)
if err != nil { if err != nil {
return "", err return "", err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment