Merge: * filter: skip comment lines starting with '#'

* commit 'b034e25b26ec01c8b2607726646c55777ba66a1d':
  * filter: skip comment lines starting with '#'
This commit is contained in:
Andrey Meshkov 2020-05-07 20:10:45 +03:00
commit 6d136ee2cb
2 changed files with 3 additions and 0 deletions

View File

@ -478,6 +478,8 @@ func (f *Filtering) parseFilterContents(file io.Reader) (int, uint32, string) {
name = m[0][1] name = m[0][1]
seenTitle = true seenTitle = true
} }
} else if line[0] == '#' {
continue
} else { } else {
rulesCount++ rulesCount++
} }

View File

@ -14,6 +14,7 @@ import (
func testStartFilterListener() net.Listener { func testStartFilterListener() net.Listener {
http.HandleFunc("/filters/1.txt", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/filters/1.txt", func(w http.ResponseWriter, r *http.Request) {
content := `||example.org^$third-party content := `||example.org^$third-party
# Inline comment example
||example.com^$third-party ||example.com^$third-party
0.0.0.0 example.com 0.0.0.0 example.com
` `