Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31af2decf4 | ||
|
|
17c5ed144f | ||
|
|
e870e71637 | ||
|
|
f9f617878d |
1
auth.go
1
auth.go
@@ -125,6 +125,7 @@ func newAuthorization(secretID, secretKey string, req *http.Request, authTime *A
|
|||||||
keyTime := authTime.keyString()
|
keyTime := authTime.keyString()
|
||||||
signKey := calSignKey(secretKey, keyTime)
|
signKey := calSignKey(secretKey, keyTime)
|
||||||
|
|
||||||
|
req.Header.Set("Host", req.Host)
|
||||||
formatHeaders := *new(string)
|
formatHeaders := *new(string)
|
||||||
signedHeaderList := *new([]string)
|
signedHeaderList := *new([]string)
|
||||||
formatHeaders, signedHeaderList = genFormatHeaders(req.Header)
|
formatHeaders, signedHeaderList = genFormatHeaders(req.Header)
|
||||||
|
|||||||
2
cos.go
2
cos.go
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Version current go sdk version
|
// Version current go sdk version
|
||||||
Version = "0.7.7"
|
Version = "0.7.8"
|
||||||
userAgent = "cos-go-sdk-v5/" + Version
|
userAgent = "cos-go-sdk-v5/" + Version
|
||||||
contentTypeXML = "application/xml"
|
contentTypeXML = "application/xml"
|
||||||
defaultServiceBaseURL = "http://service.cos.myqcloud.com"
|
defaultServiceBaseURL = "http://service.cos.myqcloud.com"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -236,11 +237,15 @@ type ObjectCopyResult struct {
|
|||||||
//
|
//
|
||||||
// https://cloud.tencent.com/document/product/436/10881
|
// https://cloud.tencent.com/document/product/436/10881
|
||||||
func (s *ObjectService) Copy(ctx context.Context, name, sourceURL string, opt *ObjectCopyOptions, id ...string) (*ObjectCopyResult, *Response, error) {
|
func (s *ObjectService) Copy(ctx context.Context, name, sourceURL string, opt *ObjectCopyOptions, id ...string) (*ObjectCopyResult, *Response, error) {
|
||||||
|
surl := strings.SplitN(sourceURL, "/", 2)
|
||||||
|
if len(surl) < 2 {
|
||||||
|
return nil, nil, errors.New(fmt.Sprintf("x-cos-copy-source format error: %s", sourceURL))
|
||||||
|
}
|
||||||
var u string
|
var u string
|
||||||
if len(id) == 1 {
|
if len(id) == 1 {
|
||||||
u = fmt.Sprintf("%s?versionId=%s", encodeURIComponent(sourceURL), id[0])
|
u = fmt.Sprintf("%s/%s?versionId=%s", surl[0], encodeURIComponent(surl[1]), id[0])
|
||||||
} else if len(id) == 0 {
|
} else if len(id) == 0 {
|
||||||
u = encodeURIComponent(sourceURL)
|
u = fmt.Sprintf("%s/%s", surl[0], encodeURIComponent(surl[1]))
|
||||||
} else {
|
} else {
|
||||||
return nil, nil, errors.New("wrong params")
|
return nil, nil, errors.New("wrong params")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user