From 7ee2f208ddfe52a0ab73d107dde1155ef99db0fc Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 7 Aug 2023 19:01:49 +0800 Subject: [PATCH] fix: cos option --- pkg/common/db/s3/cos/cos.go | 2 +- pkg/common/db/s3/minio/minio.go | 2 +- pkg/common/db/s3/oss/oss.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 772a752e3..66c083429 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -320,7 +320,7 @@ func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, query.Set("response-content-type", opt.ContentType) } if opt.Filename != "" { - query.Set("response-content-disposition", `attachment; filename="`+opt.Filename+`"`) + query.Set("response-content-disposition", `attachment; filename=`+strconv.Quote(opt.Filename)) } if len(query) > 0 { option.Query = &query diff --git a/pkg/common/db/s3/minio/minio.go b/pkg/common/db/s3/minio/minio.go index db6ff03e8..b5d2167fc 100644 --- a/pkg/common/db/s3/minio/minio.go +++ b/pkg/common/db/s3/minio/minio.go @@ -364,7 +364,7 @@ func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration reqParams.Set("response-content-type", opt.ContentType) } if opt.Filename != "" { - reqParams.Set("response-content-disposition", `attachment; filename="`+opt.Filename+`"`) + reqParams.Set("response-content-disposition", `attachment; filename=`+strconv.Quote(opt.Filename)) } } if expire <= 0 { diff --git a/pkg/common/db/s3/oss/oss.go b/pkg/common/db/s3/oss/oss.go index a63e9f515..95b757f57 100644 --- a/pkg/common/db/s3/oss/oss.go +++ b/pkg/common/db/s3/oss/oss.go @@ -325,7 +325,7 @@ func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, opts = append(opts, oss.ResponseContentType(opt.ContentType)) } if opt.Filename != "" { - opts = append(opts, oss.ResponseContentDisposition(`attachment; filename="`+opt.Filename+`"`)) + opts = append(opts, oss.ResponseContentDisposition(`attachment; filename=`+strconv.Quote(opt.Filename))) } } if expire <= 0 {