Skip to content

Commit 3ee574e

Browse files
author
jojoliang
committed
update crc
1 parent cb37d8f commit 3ee574e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cos.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (c *Client) doAPI(ctx context.Context, req *http.Request, result interface{
310310
scoscrc := response.Header.Get("x-cos-hash-crc64ecma")
311311
icoscrc, err := strconv.ParseUint(scoscrc, 10, 64)
312312
if icoscrc != localcrc {
313-
return response, fmt.Errorf("verification failed, want:%v, return:%v, x-cos-hash-crc64ecma:%v, err:%v", localcrc, icoscrc, scoscrc, err)
313+
return response, fmt.Errorf("verification failed, want:%v, return:%v, x-cos-hash-crc64ecma:%v, err:%v, header:%+v", localcrc, icoscrc, scoscrc, err, response.Header)
314314
}
315315
}
316316
}

object.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func (s *ObjectService) Append(ctx context.Context, name string, position int, r
628628
if s.client.Conf.EnableCRC && reader.writer != nil {
629629
wanted := hex.EncodeToString(reader.Sum())
630630
if wanted != resp.Header.Get("x-cos-content-sha1") {
631-
return res, resp, fmt.Errorf("append verification failed, want:%v, return:%v", wanted, resp.Header.Get("x-cos-content-sha1"))
631+
return res, resp, fmt.Errorf("append verification failed, want:%v, return:%v, header:%+v", wanted, resp.Header.Get("x-cos-content-sha1"), resp.Header)
632632
}
633633
}
634634
np, err := strconv.ParseInt(resp.Header.Get("x-cos-next-append-position"), 10, 64)
@@ -1063,7 +1063,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
10631063
scoscrc := rsp.Header.Get("x-cos-hash-crc64ecma")
10641064
icoscrc, _ := strconv.ParseUint(scoscrc, 10, 64)
10651065
if icoscrc != localcrc {
1066-
return result, rsp, fmt.Errorf("verification failed, want:%v, return:%v", localcrc, icoscrc)
1066+
return result, rsp, fmt.Errorf("verification failed, want:%v, return:%v, header:%+v", localcrc, icoscrc, rsp.Header)
10671067
}
10681068
}
10691069
return result, rsp, nil
@@ -1196,7 +1196,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
11961196
scoscrc := resp.Header.Get("x-cos-hash-crc64ecma")
11971197
icoscrc, err := strconv.ParseUint(scoscrc, 10, 64)
11981198
if icoscrc != localcrc {
1199-
return v, resp, fmt.Errorf("verification failed, want:%v, return:%v, x-cos-hash-crc64ecma: %v, err:%v", localcrc, icoscrc, scoscrc, err)
1199+
return v, resp, fmt.Errorf("verification failed, want:%v, return:%v, x-cos-hash-crc64ecma: %v, err:%v, header:%+v", localcrc, icoscrc, scoscrc, err, resp.Header)
12001200
}
12011201
}
12021202
return v, resp, err
@@ -1330,7 +1330,7 @@ func (s *ObjectService) Download(ctx context.Context, name string, filepath stri
13301330
return rsp, err
13311331
}
13321332
if localcrc != icoscrc {
1333-
return rsp, fmt.Errorf("verification failed, want:%v, return:%v", icoscrc, localcrc)
1333+
return rsp, fmt.Errorf("verification failed, want:%v, return:%v, header:%+v", icoscrc, localcrc, resp.Header)
13341334
}
13351335
}
13361336
return rsp, err
@@ -1449,7 +1449,7 @@ func (s *ObjectService) Download(ctx context.Context, name string, filepath stri
14491449
return resp, err
14501450
}
14511451
if localcrc != icoscrc {
1452-
return resp, fmt.Errorf("verification failed, want:%v, return:%v", icoscrc, localcrc)
1452+
return resp, fmt.Errorf("verification failed, want:%v, return:%v, header:%+v", icoscrc, localcrc, resp.Header)
14531453
}
14541454
}
14551455
return resp, err

0 commit comments

Comments
 (0)