diff --git a/rules/provider/provider.go b/rules/provider/provider.go index a4271655..65d21d2f 100644 --- a/rules/provider/provider.go +++ b/rules/provider/provider.go @@ -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)