Skip to content

Commit

Permalink
Return an empty digest where the Parser validation fails
Browse files Browse the repository at this point in the history
Signed-off-by: Nima Talebi <[email protected]>
  • Loading branch information
nima committed Jul 15, 2022
1 parent 11097c2 commit 6c1940b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ var (
// be returned if the format is invalid.
func Parse(s string) (Digest, error) {
d := Digest(s)
return d, d.Validate()
if err := d.Validate(); err != nil {
return "", err
}
return d, nil
}

// FromReader consumes the content of rd until io.EOF, returning canonical digest.
Expand Down

0 comments on commit 6c1940b

Please sign in to comment.