diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 4d9d8d098..bc924f3cd 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -288,7 +288,7 @@ func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, style = append(style, "format/"+opt.Image.Format) } if len(style) > 0 { - imageMogr = "&imageMogr2/thumbnail/" + strings.Join(style, "/") + "/ignore-error/1" + imageMogr = "imageMogr2/thumbnail/" + strings.Join(style, "/") + "/ignore-error/1" } } if opt.ContentType != "" { @@ -310,11 +310,14 @@ func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, if err != nil { return "", err } - urlStr := rawURL.String() if imageMogr != "" { - urlStr += imageMogr + if rawURL.RawQuery == "" { + rawURL.RawQuery = imageMogr + } else { + rawURL.RawQuery = rawURL.RawQuery + "&" + imageMogr + } } - return urlStr, nil + return rawURL.String(), nil } func (c *Cos) getPresignedURL(ctx context.Context, name string, expire time.Duration, opt *cos.PresignedURLOptions) (*url.URL, error) { @@ -322,16 +325,16 @@ func (c *Cos) getPresignedURL(ctx context.Context, name string, expire time.Dura return c.client.Object.GetPresignedURL(ctx, http.MethodGet, name, c.credential.SecretID, c.credential.SecretKey, expire, opt) } u := c.client.Object.GetObjectURL(name) - if opt.Query != nil && len(*opt.Query) > 0 { - query := u.Query() - if len(query) == 0 { - query = *opt.Query - } else { - for key := range *opt.Query { - query[key] = (*opt.Query)[key] - } - } - u.RawQuery = query.Encode() - } + //if opt.Query != nil && len(*opt.Query) > 0 { + // query := u.Query() + // if len(query) == 0 { + // query = *opt.Query + // } else { + // for key := range *opt.Query { + // query[key] = (*opt.Query)[key] + // } + // } + // u.RawQuery = query.Encode() + //} return u, nil }