mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-5395: Make scheme and host (but not path) case-insensitive in whitelist
This commit is contained in:
parent
af440460e1
commit
137eb40fab
@ -55,14 +55,14 @@ public class Whitelist {
|
|||||||
if (scheme == null || "*".equals(scheme)) {
|
if (scheme == null || "*".equals(scheme)) {
|
||||||
this.scheme = null;
|
this.scheme = null;
|
||||||
} else {
|
} else {
|
||||||
this.scheme = Pattern.compile(regexFromPattern(scheme, false));
|
this.scheme = Pattern.compile(regexFromPattern(scheme, false), Pattern.CASE_INSENSITIVE);
|
||||||
}
|
}
|
||||||
if ("*".equals(host)) {
|
if ("*".equals(host)) {
|
||||||
this.host = null;
|
this.host = null;
|
||||||
} else if (host.startsWith("*.")) {
|
} else if (host.startsWith("*.")) {
|
||||||
this.host = Pattern.compile("([a-z0-9.-]*\\.)?" + regexFromPattern(host.substring(2), false));
|
this.host = Pattern.compile("([a-z0-9.-]*\\.)?" + regexFromPattern(host.substring(2), false), Pattern.CASE_INSENSITIVE);
|
||||||
} else {
|
} else {
|
||||||
this.host = Pattern.compile(regexFromPattern(host, false));
|
this.host = Pattern.compile(regexFromPattern(host, false), Pattern.CASE_INSENSITIVE);
|
||||||
}
|
}
|
||||||
if (port == null || "*".equals(port)) {
|
if (port == null || "*".equals(port)) {
|
||||||
this.port = null;
|
this.port = null;
|
||||||
@ -120,7 +120,7 @@ public class Whitelist {
|
|||||||
whiteList = null;
|
whiteList = null;
|
||||||
}
|
}
|
||||||
else { // specific access
|
else { // specific access
|
||||||
Pattern parts = Pattern.compile("^((\\*|[a-z-]+)://)?(\\*|((\\*\\.)?[^*/:]+))?(:(\\d+))?(/.*)?");
|
Pattern parts = Pattern.compile("^((\\*|[A-Za-z-]+)://)?(\\*|((\\*\\.)?[^*/:]+))?(:(\\d+))?(/.*)?");
|
||||||
Matcher m = parts.matcher(origin);
|
Matcher m = parts.matcher(origin);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
String scheme = m.group(2);
|
String scheme = m.group(2);
|
||||||
|
Loading…
Reference in New Issue
Block a user