diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 57a205cbe..d6b1961b9 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -185,7 +185,7 @@ func (c *Cos) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, erro if res.ETag = strings.ToLower(strings.ReplaceAll(info.Header.Get("ETag"), `"`, "")); res.ETag == "" { return nil, errors.New("StatObject etag not found") } - if contentLengthStr := info.Header.Get("Content-Length"); contentLengthStr == "" { + if contentLengthStr := info.Header.Get(http.CanonicalHeaderKey("Content-Length")); contentLengthStr == "" { return nil, errors.New("StatObject content-length not found") } else { res.Size, err = strconv.ParseInt(contentLengthStr, 10, 64) diff --git a/pkg/common/db/s3/oss/oss.go b/pkg/common/db/s3/oss/oss.go index 384ce8093..dab5c2f1d 100644 --- a/pkg/common/db/s3/oss/oss.go +++ b/pkg/common/db/s3/oss/oss.go @@ -188,7 +188,7 @@ func (o *OSS) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, erro if res.ETag = strings.ToLower(strings.ReplaceAll(header.Get("ETag"), `"`, ``)); res.ETag == "" { return nil, errors.New("StatObject etag not found") } - if contentLengthStr := header.Get("Content-Length"); contentLengthStr == "" { + if contentLengthStr := header.Get(http.CanonicalHeaderKey("Content-Length")); contentLengthStr == "" { return nil, errors.New("StatObject content-length not found") } else { res.Size, err = strconv.ParseInt(contentLengthStr, 10, 64)