Skip to content

Commit 1ec2594

Browse files
committed
Return an empty digest where the Parser validation fails
Signed-off-by: Nima Talebi <[email protected]>
1 parent 809b79c commit 1ec2594

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

digest.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ var (
8080
// be returned if the format is invalid.
8181
func Parse(s string) (Digest, error) {
8282
d := Digest(s)
83-
return d, d.Validate()
83+
if err := d.Validate(); err != nil {
84+
return "", err
85+
}
86+
return d, nil
8487
}
8588

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

0 commit comments

Comments
 (0)