From e8226af388052cdf72e317099aa08a5e9189ad87 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 7 Aug 2023 18:48:01 +0800 Subject: [PATCH] fix: cos option --- pkg/common/db/s3/cos/cos.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 2518fbe4d..772a752e3 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -263,7 +263,7 @@ func (c *Cos) ListUploadedParts(ctx context.Context, uploadID string, name strin func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { var imageMogr string //snapshot := make(url.Values) - var option *cos.PresignedURLOptions + var option cos.PresignedURLOptions if opt != nil { query := make(url.Values) if opt.Image != nil { @@ -323,9 +323,7 @@ func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, query.Set("response-content-disposition", `attachment; filename="`+opt.Filename+`"`) } if len(query) > 0 { - option = &cos.PresignedURLOptions{ - Query: &query, - } + option.Query = &query } } if expire <= 0 { @@ -333,7 +331,7 @@ func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, } else if expire < time.Second { expire = time.Second } - rawURL, err := c.client.Object.GetPresignedURL(ctx, http.MethodGet, name, c.credential.SecretID, c.credential.SecretKey, expire, option) + rawURL, err := c.client.Object.GetPresignedURL(ctx, http.MethodGet, name, c.credential.SecretID, c.credential.SecretKey, expire, &option) if err != nil { return "", err }