Merge pull request #107 in DNS/adguard-dns from fix/460 to master

* commit 'c500345d16586e5a7c917611d52261beac2ac501':
  Fix #460
This commit is contained in:
Eugene Bujak 2018-11-26 14:47:05 +03:00
commit d9a65631b9
2 changed files with 14 additions and 0 deletions

View File

@ -474,6 +474,15 @@ func TestDnsFilterWhitelist(t *testing.T) {
d.checkMatch(t, "example.org")
d.checkMatchEmpty(t, "test.example.org")
d.checkMatchEmpty(t, "test.test.example.org")
d.checkAddRule(t, "||googleadapis.l.google.com^|")
d.checkMatch(t, "googleadapis.l.google.com")
d.checkMatch(t, "test.googleadapis.l.google.com")
d.checkAddRule(t, "@@||googleadapis.l.google.com|")
d.checkMatchEmpty(t, "googleadapis.l.google.com")
d.checkMatchEmpty(t, "test.googleadapis.l.google.com")
}
func TestDnsFilterImportant(t *testing.T) {

View File

@ -72,6 +72,11 @@ func getSuffix(rule string) (bool, string) {
// last char was checked, eat it
rule = rule[:len(rule)-1]
// it might also end with ^|
if rule[len(rule)-1] == '^' {
rule = rule[:len(rule)-1]
}
// check that it doesn't have any special characters inside
for _, r := range rule {
switch r {