Skip to content

Commit

Permalink
Add validation error to digesting reader
Browse files Browse the repository at this point in the history
The reason is hidden if `expectedDigest.Validate()` errors. This patch
will add the error message to the stack to provide more details.

Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Feb 27, 2024
1 parent afda0f0 commit 2b21867
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion copy/digesting_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type digestingReader struct {
func newDigestingReader(source io.Reader, expectedDigest digest.Digest) (*digestingReader, error) {
var digester digest.Digester
if err := expectedDigest.Validate(); err != nil {
return nil, fmt.Errorf("Invalid digest specification %s", expectedDigest)
return nil, fmt.Errorf("Invalid digest specification %s: %w", expectedDigest, err)
}
digestAlgorithm := expectedDigest.Algorithm()
if !digestAlgorithm.Available() {
Expand Down

0 comments on commit 2b21867

Please sign in to comment.