Skip to content

Commit

Permalink
insert sha256: prefix if not provided (#381)
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <bob.callaway@gmail.com>
  • Loading branch information
bobcallaway authored Jul 21, 2021
1 parent 07c8e8f commit d8ac9f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/rekor-cli/app/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,12 @@ var searchCmd = &cobra.Command{
artifactStr := viper.GetString("artifact")
sha := viper.GetString("sha")
if sha != "" {
params.Query.Hash = sha
var prefix string
if !strings.HasPrefix(sha, "sha256:") {
prefix = "sha256:"
}
params.Query.Hash = fmt.Sprintf("%v%v", prefix, sha)
} else if artifactStr != "" {

hasher := sha256.New()
var tee io.Reader
if isURL(artifactStr) {
Expand Down

0 comments on commit d8ac9f8

Please sign in to comment.