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 }