From 0c00da5f4f96cfc6548cea11d9a35c842aedb236 Mon Sep 17 00:00:00 2001 From: jojoliang Date: Mon, 8 Mar 2021 21:15:19 +0800 Subject: [PATCH] update --- object.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/object.go b/object.go index 585b554..f664b39 100644 --- a/object.go +++ b/object.go @@ -771,6 +771,13 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string Key: name, ETag: rsp.Header.Get("ETag"), } + if rsp != nil && opt.EnableVerification { + scoscrc := rsp.Header.Get("x-cos-hash-crc64ecma") + icoscrc, _ := strconv.ParseUint(scoscrc, 10, 64) + if icoscrc != localcrc { + return result, rsp, fmt.Errorf("verification failed, want:%v, return:%v", localcrc, icoscrc) + } + } return result, rsp, nil }