Merge branch 'v3dev' of github.com:OpenIMSDK/Open-IM-Server into v3dev

test-v3dev1^2
wangchuxiao 1 year ago
commit fd87d70b56

@ -129,7 +129,7 @@ func (t *thirdServer) CompleteMultipartUpload(ctx context.Context, req *third.Co
return nil, err return nil, err
} }
return &third.CompleteMultipartUploadResp{ return &third.CompleteMultipartUploadResp{
Url: t.apiAddress(obj.Key), Url: t.apiAddress(obj.Name),
}, nil }, nil
} }

@ -41,10 +41,9 @@ func NewCos() (s3.Interface, error) {
} }
type Cos struct { type Cos struct {
statObjectURL string copyURL string
copyURL string client *cos.Client
client *cos.Client credential *cos.Credential
credential *cos.Credential
} }
func (c *Cos) Engine() string { func (c *Cos) Engine() string {
@ -170,7 +169,7 @@ func (c *Cos) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, erro
if name != "" && name[0] == '/' { if name != "" && name[0] == '/' {
name = name[1:] 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 { if err != nil {
return nil, err return nil, err
} }
@ -201,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) { func (c *Cos) CopyObject(ctx context.Context, src string, dst string) (*s3.CopyObjectInfo, error) {
result, _, err := c.client.Object.Copy(ctx, src, c.copyURL+dst, &cos.ObjectCopyOptions{}) result, _, err := c.client.Object.Copy(ctx, dst, c.copyURL+src, &cos.ObjectCopyOptions{})
if err != nil { if err != nil {
return nil, err return nil, err
} }

Loading…
Cancel
Save