From bdf93565a317deeb10a9bad71bff8b700888b571 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 12 Jul 2023 14:01:48 +0800 Subject: [PATCH] s3 AccessURL --- pkg/common/db/s3/cos/cos.go | 4 ++-- pkg/common/db/s3/minio/minio.go | 4 ++-- pkg/common/db/s3/oss/oss.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index a6c958813..4b1b4aa4d 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -232,7 +232,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) { - reqParams := make(url.Values) + //reqParams := make(url.Values) //if opt != nil { // if opt.ContentType != "" { // reqParams.Set("Content-Type", opt.ContentType) @@ -246,7 +246,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, reqParams) + rawURL, err := c.client.Object.GetPresignedURL(ctx, http.MethodGet, name, c.credential.SecretID, c.credential.SecretKey, expire, nil) if err != nil { return "", err } diff --git a/pkg/common/db/s3/minio/minio.go b/pkg/common/db/s3/minio/minio.go index c6070bc02..367cbe8a8 100644 --- a/pkg/common/db/s3/minio/minio.go +++ b/pkg/common/db/s3/minio/minio.go @@ -228,7 +228,7 @@ func (m *Minio) ListUploadedParts(ctx context.Context, uploadID string, name str } func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { - reqParams := make(url.Values) + //reqParams := make(url.Values) //if opt != nil { // if opt.ContentType != "" { // reqParams.Set("Content-Type", opt.ContentType) @@ -242,7 +242,7 @@ func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration } else if expire < time.Second { expire = time.Second } - u, err := m.core.Client.PresignedGetObject(ctx, m.bucket, name, expire, reqParams) + u, err := m.core.Client.PresignedGetObject(ctx, m.bucket, name, expire, nil) if err != nil { return "", err } diff --git a/pkg/common/db/s3/oss/oss.go b/pkg/common/db/s3/oss/oss.go index cd54c341b..f2b50da50 100644 --- a/pkg/common/db/s3/oss/oss.go +++ b/pkg/common/db/s3/oss/oss.go @@ -241,7 +241,7 @@ func (o *OSS) ListUploadedParts(ctx context.Context, uploadID string, name strin } func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { - var opts []oss.Option + //var opts []oss.Option //if opt != nil { // if opt.ContentType != "" { // opts = append(opts, oss.ContentType(opt.ContentType)) @@ -255,5 +255,5 @@ func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, } else if expire < time.Second { expire = time.Second } - return o.bucket.SignURL(name, http.MethodGet, int64(expire/time.Second), opts...) + return o.bucket.SignURL(name, http.MethodGet, int64(expire/time.Second)) }