Skip to content

Commit e6618d1

Browse files
author
jojoliang
committed
update
1 parent 23ad6e2 commit e6618d1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func NewBucketURL(bucketName, region string, secure bool) *url.URL {
7171
}
7272

7373
type Config struct {
74-
DisableCRC bool
74+
EnableCRC bool
7575
}
7676

7777
// Client is a client manages communication with the COS API.
@@ -119,7 +119,7 @@ func NewClient(uri *BaseURL, httpClient *http.Client) *Client {
119119
UserAgent: userAgent,
120120
BaseURL: baseURL,
121121
Conf: &Config{
122-
DisableCRC: false,
122+
EnableCRC: true,
123123
},
124124
}
125125
c.common.client = c

object.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
746746
return nil, nil, err
747747
}
748748
// 校验
749-
if !s.client.Conf.DisableCRC {
749+
if s.client.Conf.EnableCRC {
750750
fd, err := os.Open(filepath)
751751
if err != nil {
752752
return nil, nil, err
@@ -771,7 +771,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
771771
Key: name,
772772
ETag: rsp.Header.Get("ETag"),
773773
}
774-
if rsp != nil && !s.client.Conf.DisableCRC {
774+
if rsp != nil && s.client.Conf.EnableCRC {
775775
scoscrc := rsp.Header.Get("x-cos-hash-crc64ecma")
776776
icoscrc, _ := strconv.ParseUint(scoscrc, 10, 64)
777777
if icoscrc != localcrc {
@@ -902,7 +902,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
902902
return v, resp, err
903903
}
904904

905-
if resp != nil && !s.client.Conf.DisableCRC {
905+
if resp != nil && s.client.Conf.EnableCRC {
906906
scoscrc := resp.Header.Get("x-cos-hash-crc64ecma")
907907
icoscrc, _ := strconv.ParseUint(scoscrc, 10, 64)
908908
if icoscrc != localcrc {

0 commit comments

Comments
 (0)