test-v3dev1
withchao 1 year ago
parent 5fd464979d
commit c411cc4bc8

@ -33,15 +33,10 @@ func NewCos() (s3.Interface, error) {
SessionToken: conf.SessionToken, SessionToken: conf.SessionToken,
}, },
}) })
statObjectURL := u.String()
if statObjectURL != "" && statObjectURL[len(statObjectURL)-1] != '/' {
statObjectURL += "/"
}
return &Cos{ return &Cos{
statObjectURL: statObjectURL, copyURL: u.Host + "/",
copyURL: u.Host + "/", client: client,
client: client, credential: client.GetCredential(),
credential: client.GetCredential(),
}, nil }, nil
} }
@ -65,7 +60,6 @@ func (c *Cos) PartLimit() *s3.PartLimit {
} }
func (c *Cos) InitiateMultipartUpload(ctx context.Context, name string) (*s3.InitiateMultipartUploadResult, error) { func (c *Cos) InitiateMultipartUpload(ctx context.Context, name string) (*s3.InitiateMultipartUploadResult, error) {
name = c.client.BaseURL.BucketURL.String() + name
result, _, err := c.client.Object.InitiateMultipartUpload(ctx, name, nil) result, _, err := c.client.Object.InitiateMultipartUpload(ctx, name, nil)
if err != nil { if err != nil {
return nil, err return nil, err

Loading…
Cancel
Save