Fixed a issue with random invalid matches in DSL (#2195)

dev
Ice3man 2022-06-21 21:58:43 +05:30 committed by GitHub
parent af4854f90d
commit 50d21c0464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -59,7 +59,9 @@ func (matcher *Matcher) MatchWords(corpus string, data map[string]interface{}) (
word, err = expressions.Evaluate(word, data)
if err != nil {
gologger.Warning().Msgf("Error while evaluating word matcher: %q", word)
continue
if matcher.condition == ANDCondition {
return false, []string{}
}
}
// Continue if the word doesn't match
if !strings.Contains(corpus, word) {
@ -180,6 +182,9 @@ func (matcher *Matcher) MatchDSL(data map[string]interface{}) bool {
result, err := expression.Evaluate(data)
if err != nil {
if matcher.condition == ANDCondition {
return false
}
if strings.Contains(err.Error(), "No parameter") {
gologger.Warning().Msgf("[%s] %s", data["template-id"], err.Error())
} else {