From 4ca7c4be1fc0aeca41587ff6c74dd27e12ff54c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 19 Jul 2023 00:47:55 -0700 Subject: [PATCH] dont consume reader when calculating digest --- server/images.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/images.go b/server/images.go index 387af3b4..6b8cd475 100644 --- a/server/images.go +++ b/server/images.go @@ -651,8 +651,7 @@ func createConfigLayer(layers []string) (*LayerReader, error) { return nil, err } - buf := bytes.NewBuffer(configJSON) - digest, size := GetSHA256Digest(buf) + digest, size := GetSHA256Digest(bytes.NewBuffer(configJSON)) layer := &LayerReader{ Layer: Layer{ @@ -660,7 +659,7 @@ func createConfigLayer(layers []string) (*LayerReader, error) { Digest: digest, Size: size, }, - Reader: buf, + Reader: bytes.NewBuffer(configJSON), } return layer, nil }