Pull request: filtering: fix legacy rewrite domain case

Updates #3351.

Squashed commit of the following:

commit cc1c72cc13026ed703bb140e55dc3eb886846e48
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jul 13 17:23:33 2021 +0300

    filtering: fix legacy rewrite domain case
This commit is contained in:
Ainar Garipov
2021-07-13 19:45:25 +03:00
parent ff4905b2a2
commit 167447547a
3 changed files with 19 additions and 2 deletions

View File

@@ -80,6 +80,11 @@ func (a rewritesSorted) Less(i, j int) bool {
// prepare prepares the a new or decoded entry.
func (r *RewriteEntry) prepare() {
// TODO(a.garipov): Write a case-agnostic version of strings.HasSuffix
// and use it in matchDomainWildcard instead of using strings.ToLower
// everywhere.
r.Domain = strings.ToLower(r.Domain)
switch r.Answer {
case "AAAA":
r.IP = nil