fix(provenance): Ports error check for `Digest` to v3

This is a port of #5672

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
pull/6496/head
Taylor Thomas 5 years ago
parent faa9048580
commit 9b87721c1f

@ -402,6 +402,8 @@ func DigestFile(filename string) (string, error) {
// Helm uses SHA256 as its default hash for all non-cryptographic applications.
func Digest(in io.Reader) (string, error) {
hash := crypto.SHA256.New()
io.Copy(hash, in)
if _, err := io.Copy(hash, in); err != nil {
return "", nil
}
return hex.EncodeToString(hash.Sum(nil)), nil
}

Loading…
Cancel
Save