From c32b437821a57aa639a126b977300d360375fa2f Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 12 Jul 2023 12:34:00 +0800 Subject: [PATCH] s3 cos test --- pkg/common/db/s3/cos/cos.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 754f0e662..e1d1b3a49 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -41,10 +41,9 @@ func NewCos() (s3.Interface, error) { } type Cos struct { - statObjectURL string - copyURL string - client *cos.Client - credential *cos.Credential + copyURL string + client *cos.Client + credential *cos.Credential } func (c *Cos) Engine() string { @@ -170,7 +169,6 @@ func (c *Cos) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, erro if name != "" && name[0] == '/' { name = name[1:] } - //info, err := c.client.Object.Head(ctx, c.statObjectURL+name, nil) info, err := c.client.Object.Head(ctx, name, nil) if err != nil { return nil, err @@ -202,7 +200,7 @@ func (c *Cos) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, erro } func (c *Cos) CopyObject(ctx context.Context, src string, dst string) (*s3.CopyObjectInfo, error) { - result, _, err := c.client.Object.Copy(ctx, dst, src, &cos.ObjectCopyOptions{}) + result, _, err := c.client.Object.Copy(ctx, dst, c.copyURL+src, &cos.ObjectCopyOptions{}) if err != nil { return nil, err }