fix: ruleProvider panic
This commit is contained in:
parent
81bef30ae0
commit
c2d1f71305
1 changed files with 8 additions and 1 deletions
|
@ -187,6 +187,9 @@ func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (any, er
|
|||
firstLineLength = -1 // don't return ErrNoPayload when read last line
|
||||
str = string(line)
|
||||
str = strings.TrimSpace(str)
|
||||
if len(str) == 0 {
|
||||
continue
|
||||
}
|
||||
if str[0] == '#' { // comment
|
||||
continue
|
||||
}
|
||||
|
@ -194,7 +197,11 @@ func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (any, er
|
|||
continue
|
||||
}
|
||||
case P.YamlRule:
|
||||
if bytes.TrimSpace(line)[0] == '#' { // comment
|
||||
trimLine := bytes.TrimSpace(line)
|
||||
if len(trimLine) == 0 {
|
||||
continue
|
||||
}
|
||||
if trimLine[0] == '#' { // comment
|
||||
continue
|
||||
}
|
||||
firstLineBuffer.Write(line)
|
||||
|
|
Loading…
Reference in a new issue