Merge pull request #32136 from SebTardif/fix-digest-error-swallow

fix(provenance): check error return in Digest and encodeRelease
pull/32210/head
George Jenkins 6 days ago committed by GitHub
commit fb9791f492
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -388,7 +388,7 @@ func DigestFile(filename string) (string, error) {
func Digest(in io.Reader) (string, error) {
hash := crypto.SHA256.New()
if _, err := io.Copy(hash, in); err != nil {
return "", nil
return "", err
}
return hex.EncodeToString(hash.Sum(nil)), nil
}

@ -46,9 +46,12 @@ func encodeRelease(rls *rspb.Release) (string, error) {
return "", err
}
if _, err = w.Write(b); err != nil {
w.Close()
return "", err
}
if err = w.Close(); err != nil {
return "", err
}
w.Close()
return b64.EncodeToString(buf.Bytes()), nil
}

Loading…
Cancel
Save