mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-14 18:51:34 +03:00
* filter: skip comment lines starting with '#'
Fix #771, filter skips comment lines starting with '#'. Handle exclamation inline comments. Refactor for correct logic flow. Split out hashtag comment logic from exclamation. Remove trailing whitespace.
This commit is contained in:
parent
f250fc16a2
commit
b034e25b26
@ -478,6 +478,8 @@ func (f *Filtering) parseFilterContents(file io.Reader) (int, uint32, string) {
|
||||
name = m[0][1]
|
||||
seenTitle = true
|
||||
}
|
||||
} else if line[0] == '#' {
|
||||
continue
|
||||
} else {
|
||||
rulesCount++
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
func testStartFilterListener() net.Listener {
|
||||
http.HandleFunc("/filters/1.txt", func(w http.ResponseWriter, r *http.Request) {
|
||||
content := `||example.org^$third-party
|
||||
# Inline comment example
|
||||
||example.com^$third-party
|
||||
0.0.0.0 example.com
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user