You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2014/08/14 23:21:10 UTC
[02/10] android commit: Extend whitelist to handle URLs without //
chars
Extend whitelist to handle URLs without // chars
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/955133f1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/955133f1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/955133f1
Branch: refs/heads/4.0.x
Commit: 955133f1737cb9352de8c20fd22b30967fc4e1f9
Parents: c2cafb4
Author: Ian Clelland <ic...@chromium.org>
Authored: Thu Jun 26 15:48:50 2014 -0400
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Jul 31 08:11:40 2014 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/Whitelist.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/955133f1/framework/src/org/apache/cordova/Whitelist.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Whitelist.java b/framework/src/org/apache/cordova/Whitelist.java
index ecbb7f6..5101ec3 100644
--- a/framework/src/org/apache/cordova/Whitelist.java
+++ b/framework/src/org/apache/cordova/Whitelist.java
@@ -124,15 +124,15 @@ public class Whitelist {
whiteList = null;
}
else { // specific access
- Pattern parts = Pattern.compile("^((\\*|[A-Za-z-]+)://)?(\\*|((\\*\\.)?[^*/:]+))?(:(\\d+))?(/.*)?");
+ Pattern parts = Pattern.compile("^((\\*|[A-Za-z-]+):(//)?)?(\\*|((\\*\\.)?[^*/:]+))?(:(\\d+))?(/.*)?");
Matcher m = parts.matcher(origin);
if (m.matches()) {
String scheme = m.group(2);
- String host = m.group(3);
+ String host = m.group(4);
// Special case for two urls which are allowed to have empty hosts
if (("file".equals(scheme) || "content".equals(scheme)) && host == null) host = "*";
- String port = m.group(7);
- String path = m.group(8);
+ String port = m.group(8);
+ String path = m.group(9);
if (scheme == null) {
// XXX making it stupid friendly for people who forget to include protocol/SSL
whiteList.add(new URLPattern("http", host, port, path));