From 9b41824703c78762774c08cad4c4f50c0f66c56f Mon Sep 17 00:00:00 2001 From: Robb <35880555+robbwatershed@users.noreply.github.com> Date: Sat, 8 Jan 2022 22:45:58 +0100 Subject: [PATCH] Use filename-based whitelist instead of pattern whitelist to avoid crashing when the resource contains weird characters used in regexps --- app/src/main/java/me/devsaki/hentoid/util/AdBlocker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/me/devsaki/hentoid/util/AdBlocker.java b/app/src/main/java/me/devsaki/hentoid/util/AdBlocker.java index bd5a0d4cab..23eb9ca7f9 100644 --- a/app/src/main/java/me/devsaki/hentoid/util/AdBlocker.java +++ b/app/src/main/java/me/devsaki/hentoid/util/AdBlocker.java @@ -198,7 +198,7 @@ public boolean isBlocked(@NonNull final String url) { Timber.e(iae); return true; // Avoid feeding malformed URLs to Chromium on older Androids (crash reported on Lollipop) } - addJsUrlPatternWhitelist("^" + cleanUrl.replace(".", "\\.") + "$"); + addJsUrlWhitelist(cleanUrl); Timber.d(">> grey file %s ALLOWED", url); }