Skip to content

Commit

Permalink
Return error in UserMetadata for nil envelopeContent
Browse files Browse the repository at this point in the history
Signed-off-by: Byron Chien <[email protected]>
  • Loading branch information
Byron Chien committed Feb 7, 2023
1 parent 350d88b commit aa647a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ type VerificationOutcome struct {

func (outcome *VerificationOutcome) UserMetadata() (map[string]string, error) {
if outcome.EnvelopeContent == nil {
return map[string]string{}, nil
return nil, errors.New("unable to find envelope content for verification outcome")
}

var payload envelope.Payload
err := json.Unmarshal(outcome.EnvelopeContent.Payload.Content, &payload)
if err != nil {
return nil, errors.New("Failed to unmarshal the payload content in the signature blob to envelope.Payload")
return nil, errors.New("failed to unmarshal the payload content in the signature blob to envelope.Payload")
}

if payload.TargetArtifact.Annotations == nil {
Expand Down

0 comments on commit aa647a9

Please sign in to comment.