From 955133f1737cb9352de8c20fd22b30967fc4e1f9 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 26 Jun 2014 15:48:50 -0400 Subject: [PATCH] Extend whitelist to handle URLs without // chars --- framework/src/org/apache/cordova/Whitelist.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/Whitelist.java b/framework/src/org/apache/cordova/Whitelist.java index ecbb7f61..5101ec35 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));