fix: cos option

pull/818/head
withchao 2 years ago
parent e8226af388
commit 7ee2f208dd

@ -320,7 +320,7 @@ func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration,
query.Set("response-content-type", opt.ContentType) query.Set("response-content-type", opt.ContentType)
} }
if opt.Filename != "" { 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 { if len(query) > 0 {
option.Query = &query option.Query = &query

@ -364,7 +364,7 @@ func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration
reqParams.Set("response-content-type", opt.ContentType) reqParams.Set("response-content-type", opt.ContentType)
} }
if opt.Filename != "" { 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 { if expire <= 0 {

@ -325,7 +325,7 @@ func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration,
opts = append(opts, oss.ResponseContentType(opt.ContentType)) opts = append(opts, oss.ResponseContentType(opt.ContentType))
} }
if opt.Filename != "" { 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 { if expire <= 0 {

Loading…
Cancel
Save