Skip to content

Commit

Permalink
filtering: imp docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Dec 19, 2022
1 parent 1bc3cc4 commit 3ad4276
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/filtering/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ func (d *DNSFilter) parseFilterLine(
return false, "", nil
}

singleHTMLCheck.Do(func() { err = checkNotHTML(line) })
singleHTMLCheck.Do(func() { err = checkNonHTML(line) })
if err != nil {
return false, "", err
}
Expand All @@ -521,12 +521,12 @@ func (d *DNSFilter) parseFilterLine(
return true, "", nil
}

// checkNotHTML detects if the line contains HTML tags. line shouldn't have leading
// space symbols.
// checkNonHTML returns an error if the line contains HTML tags instead of plain
// text. line shouldn have no leading space symbols.
//
// TODO(ameshkov): It actually gives too much false-positives. Perhaps, just
// check if trimmed string begins with angle bracket.
func checkNotHTML(line string) (err error) {
func checkNonHTML(line string) (err error) {
line = strings.ToLower(line)

if strings.HasPrefix(line, "<html") || strings.HasPrefix(line, "<!doctype") {
Expand Down

0 comments on commit 3ad4276

Please sign in to comment.