From aef07c50d6d6b765ebd9799537e8b74af89a0a67 Mon Sep 17 00:00:00 2001 From: bloved Date: Fri, 15 Jan 2021 13:28:15 +0100 Subject: [PATCH] - single/double and local lists: ignore blank/comment lines --- adlist_hosts.go | 3 +++ adlist_single.go | 3 +++ hostfile.go | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/adlist_hosts.go b/adlist_hosts.go index 44996cc..1f33e50 100644 --- a/adlist_hosts.go +++ b/adlist_hosts.go @@ -107,6 +107,9 @@ func downloadDoubleThread() { } s := fileByLines(ZabovDoubleBL) for _, v := range s { + if len(v) == 0 || strings.TrimSpace(v)[0] == '#' { + continue + } configs := _urls[v] if configs == nil { configs = stringarray{} diff --git a/adlist_single.go b/adlist_single.go index aeeffbf..4e69c42 100644 --- a/adlist_single.go +++ b/adlist_single.go @@ -108,6 +108,9 @@ func downloadThread() { s := fileByLines(ZabovSingleBL) for _, v := range s { + if len(v) == 0 || strings.TrimSpace(v)[0] == '#' { + continue + } configs := _urls[v] if configs == nil { configs = stringarray{} diff --git a/hostfile.go b/hostfile.go index c64cb98..63def50 100644 --- a/hostfile.go +++ b/hostfile.go @@ -4,6 +4,7 @@ import ( "bufio" "fmt" "os" + "strings" ) func init() { @@ -41,6 +42,9 @@ func ingestLocalBlacklists() { scanner := bufio.NewScanner(file) for scanner.Scan() { d := scanner.Text() + if len(d) == 0 || strings.TrimSpace(d)[0] == '#' { + continue + } DomainKill(d, ZabovHostsFile, configs) incrementStats("Blacklist", 1)