dont consume reader when calculating digest

This commit is contained in:
Jeffrey Morgan 2023-07-19 00:47:55 -07:00
parent 17b7af78f0
commit 4ca7c4be1f

View file

@ -651,8 +651,7 @@ func createConfigLayer(layers []string) (*LayerReader, error) {
return nil, err return nil, err
} }
buf := bytes.NewBuffer(configJSON) digest, size := GetSHA256Digest(bytes.NewBuffer(configJSON))
digest, size := GetSHA256Digest(buf)
layer := &LayerReader{ layer := &LayerReader{
Layer: Layer{ Layer: Layer{
@ -660,7 +659,7 @@ func createConfigLayer(layers []string) (*LayerReader, error) {
Digest: digest, Digest: digest,
Size: size, Size: size,
}, },
Reader: buf, Reader: bytes.NewBuffer(configJSON),
} }
return layer, nil return layer, nil
} }