FIx urlSplit

This commit is contained in:
Michal Srutek 2023-12-21 08:16:00 +01:00
parent 73c27928ca
commit 38e28bec42
5 changed files with 10 additions and 10 deletions

View File

@ -62,8 +62,8 @@ public class ContentBlockerHandler {
try { try {
u = new URI(url); u = new URI(url);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
String[] urlSplitted = url.split(":"); String[] urlSplit = url.split(":");
String scheme = urlSplitted[0]; String scheme = urlSplit[0];
URL tempUrl = new URL(url.replace(scheme, "https")); URL tempUrl = new URL(url.replace(scheme, "https"));
u = new URI(scheme, tempUrl.getUserInfo(), tempUrl.getHost(), tempUrl.getPort(), tempUrl.getPath(), tempUrl.getQuery(), tempUrl.getRef()); u = new URI(scheme, tempUrl.getUserInfo(), tempUrl.getHost(), tempUrl.getPort(), tempUrl.getPath(), tempUrl.getQuery(), tempUrl.getRef());
} }

View File

@ -1745,7 +1745,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
String urlIcon, String? rel, String? sizes, bool isManifest) { String urlIcon, String? rel, String? sizes, bool isManifest) {
List<Favicon> favicons = []; List<Favicon> favicons = [];
List<String> urlSplitted = urlIcon.split("/"); List<String> urlSplit = urlIcon.split("/");
if (!_isUrlAbsolute(urlIcon)) { if (!_isUrlAbsolute(urlIcon)) {
if (urlIcon.startsWith("/")) { if (urlIcon.startsWith("/")) {
urlIcon = urlIcon.substring(1); urlIcon = urlIcon.substring(1);
@ -1757,7 +1757,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
} }
if (isManifest) { if (isManifest) {
rel = (sizes != null) rel = (sizes != null)
? urlSplitted[urlSplitted.length - 1] ? urlSplit[urlSplit.length - 1]
.replaceFirst("-" + sizes, "") .replaceFirst("-" + sizes, "")
.split(" ")[0] .split(" ")[0]
.split(".")[0] .split(".")[0]

View File

@ -1741,7 +1741,7 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
String urlIcon, String? rel, String? sizes, bool isManifest) { String urlIcon, String? rel, String? sizes, bool isManifest) {
List<Favicon> favicons = []; List<Favicon> favicons = [];
List<String> urlSplitted = urlIcon.split("/"); List<String> urlSplit = urlIcon.split("/");
if (!_isUrlAbsolute(urlIcon)) { if (!_isUrlAbsolute(urlIcon)) {
if (urlIcon.startsWith("/")) { if (urlIcon.startsWith("/")) {
urlIcon = urlIcon.substring(1); urlIcon = urlIcon.substring(1);
@ -1753,7 +1753,7 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
} }
if (isManifest) { if (isManifest) {
rel = (sizes != null) rel = (sizes != null)
? urlSplitted[urlSplitted.length - 1] ? urlSplit[urlSplit.length - 1]
.replaceFirst("-" + sizes, "") .replaceFirst("-" + sizes, "")
.split(" ")[0] .split(" ")[0]
.split(".")[0] .split(".")[0]

View File

@ -1742,7 +1742,7 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController
String urlIcon, String? rel, String? sizes, bool isManifest) { String urlIcon, String? rel, String? sizes, bool isManifest) {
List<Favicon> favicons = []; List<Favicon> favicons = [];
List<String> urlSplitted = urlIcon.split("/"); List<String> urlSplit = urlIcon.split("/");
if (!_isUrlAbsolute(urlIcon)) { if (!_isUrlAbsolute(urlIcon)) {
if (urlIcon.startsWith("/")) { if (urlIcon.startsWith("/")) {
urlIcon = urlIcon.substring(1); urlIcon = urlIcon.substring(1);
@ -1754,7 +1754,7 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController
} }
if (isManifest) { if (isManifest) {
rel = (sizes != null) rel = (sizes != null)
? urlSplitted[urlSplitted.length - 1] ? urlSplit[urlSplit.length - 1]
.replaceFirst("-" + sizes, "") .replaceFirst("-" + sizes, "")
.split(" ")[0] .split(" ")[0]
.split(".")[0] .split(".")[0]

View File

@ -354,7 +354,7 @@ class WebPlatformInAppWebViewController extends PlatformInAppWebViewController
String urlIcon, String? rel, String? sizes, bool isManifest) { String urlIcon, String? rel, String? sizes, bool isManifest) {
List<Favicon> favicons = []; List<Favicon> favicons = [];
List<String> urlSplitted = urlIcon.split("/"); List<String> urlSplit = urlIcon.split("/");
if (!_isUrlAbsolute(urlIcon)) { if (!_isUrlAbsolute(urlIcon)) {
if (urlIcon.startsWith("/")) { if (urlIcon.startsWith("/")) {
urlIcon = urlIcon.substring(1); urlIcon = urlIcon.substring(1);
@ -366,7 +366,7 @@ class WebPlatformInAppWebViewController extends PlatformInAppWebViewController
} }
if (isManifest) { if (isManifest) {
rel = (sizes != null) rel = (sizes != null)
? urlSplitted[urlSplitted.length - 1] ? urlSplit[urlSplit.length - 1]
.replaceFirst("-" + sizes, "") .replaceFirst("-" + sizes, "")
.split(" ")[0] .split(" ")[0]
.split(".")[0] .split(".")[0]