]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Only apply domain settings to subdomain if the `*.` is used. Fixes https://redmine...
authorSoren Stoutner <soren@stoutner.com>
Tue, 21 Mar 2017 04:26:12 +0000 (21:26 -0700)
committerSoren Stoutner <soren@stoutner.com>
Tue, 21 Mar 2017 04:26:12 +0000 (21:26 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java

index 08aa9eb21f074639b376f62f7e9e00694e0273f1..e06531c6174780d655f9aad96a06996d612c72c1 100644 (file)
@@ -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;
                 }