Skip to content

Commit

Permalink
fix: default param value not applied in some cases (#1254)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Wang <whynowy@gmail.com>
  • Loading branch information
whynowy committed Jun 22, 2021
1 parent e92d105 commit 38cd9b6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sensors/triggers/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,16 @@ func ResolveParamValue(src *v1alpha1.TriggerParameterSource, events map[string]*
tmplt = src.DataTemplate
value, err = renderEventDataAsJSON(event)
}
}
if err != nil && src.Value != nil {
fmt.Printf("failed to parse the event data, using default value. err: %+v\n", err)
} else if src.Value != nil {
return *src.Value, nil
}
if err != nil {
if src.Value != nil {
fmt.Printf("failed to parse the event data, using default value. err: %+v\n", err)
return *src.Value, nil
}
return "", err
}
// Get the value corresponding to specified key within JSON object
if value != nil {
if tmplt != "" {
Expand Down

0 comments on commit 38cd9b6

Please sign in to comment.