From 251a660b85df16be00d9a60d956c438e5a3f2467 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Thu, 12 Nov 2020 17:49:28 +0300 Subject: [PATCH] smartcontract: ignore case in trigger.FromString --- pkg/smartcontract/trigger/trigger_type.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/smartcontract/trigger/trigger_type.go b/pkg/smartcontract/trigger/trigger_type.go index 0fe314da8..60f3c1b08 100644 --- a/pkg/smartcontract/trigger/trigger_type.go +++ b/pkg/smartcontract/trigger/trigger_type.go @@ -1,6 +1,9 @@ package trigger -import "fmt" +import ( + "fmt" + "strings" +) //go:generate stringer -type=Type -output=trigger_type_string.go @@ -40,8 +43,9 @@ const ( // FromString converts string to trigger Type func FromString(str string) (Type, error) { triggers := []Type{OnPersist, PostPersist, Verification, Application, All} + str = strings.ToLower(str) for _, t := range triggers { - if t.String() == str { + if strings.ToLower(t.String()) == str { return t, nil } }