From fc5f976c4e6535abe6c088155d23a67bd4596fd6 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 20 Mar 2017 21:26:12 -0700 Subject: [PATCH] Only apply domain settings to subdomain if the `*.` is used. Fixes https://redmine.stoutner.com/issues/99. --- .../activities/MainWebViewActivity.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 08aa9eb2..e06531c6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -1874,12 +1874,15 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation boolean hostHasDomainSettings = false; String domainNameInDatabase = null; - // Check all the subdomains of `hostname` against the list of domains in `domainCursor`. + // Check the hostname. + if (domainSettingsSet.contains(hostname)) { + hostHasDomainSettings = true; + domainNameInDatabase = hostname; + } + + // Check all the subdomains of `hostname` against wildcard domains in `domainCursor`. while (hostname.contains(".") && !hostHasDomainSettings) { // Stop checking if we run out of `.` or if we already know that `hostHasDomainSettings` is `true`. - if (domainSettingsSet.contains(hostname)) { // Check the host name. - hostHasDomainSettings = true; - domainNameInDatabase = hostname; - } else if (domainSettingsSet.contains("*." + hostname)) { // Check the host name prepended by `*.`. + if (domainSettingsSet.contains("*." + hostname)) { // Check the host name prepended by `*.`. hostHasDomainSettings = true; domainNameInDatabase = "*." + hostname; } -- 2.45.2