From a8c352063e9f30c6f7577c06965f74ee847fd5b8 Mon Sep 17 00:00:00 2001 From: Wayne Warren Date: Wed, 4 Nov 2020 00:06:41 -0600 Subject: [PATCH] s3: nit - ignore HeadObjectOutput if it doesn't have ContentLength --- registry/storage/driver/s3-aws/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/storage/driver/s3-aws/s3.go b/registry/storage/driver/s3-aws/s3.go index fc7a45972..de22e887c 100644 --- a/registry/storage/driver/s3-aws/s3.go +++ b/registry/storage/driver/s3-aws/s3.go @@ -733,7 +733,7 @@ func (d *driver) Stat(ctx context.Context, path string) (storagedriver.FileInfo, Bucket: aws.String(d.Bucket), Key: aws.String(d.s3Path(path)), }) - if err == nil { + if err == nil && headResp.ContentLength != nil { if headResp.ContentLength != nil { fi.Size = *headResp.ContentLength }