You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2019/03/13 18:13:34 UTC
[cordova-ios] 01/01: Null check for missing pathname
This is an automated email from the ASF dual-hosted git repository.
purplecabbage pushed a commit to branch purplecabbage-patch-1
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
commit 6e053579cf5e66ca2b1e84aea5d80ba5cbbe60bb
Author: Jesse MacFadyen <pu...@gmail.com>
AuthorDate: Wed Mar 13 11:13:28 2019 -0700
Null check for missing pathname
This is causing a crash if someone whitelists just a protocol, ex `file://`
See #539
---
bin/templates/scripts/cordova/lib/prepare.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bin/templates/scripts/cordova/lib/prepare.js b/bin/templates/scripts/cordova/lib/prepare.js
index f81085f..278af0a 100644
--- a/bin/templates/scripts/cordova/lib/prepare.js
+++ b/bin/templates/scripts/cordova/lib/prepare.js
@@ -1052,7 +1052,9 @@ function parseWhitelistUrlForATS (url, options) {
var subdomain1 = '/*.'; // wildcard in hostname
var subdomain2 = '*://*.'; // wildcard in hostname and protocol
var subdomain3 = '*://'; // wildcard in protocol only
- if (href.pathname.indexOf(subdomain1) === 0) {
+ if(!href.pathname) {
+ return null;
+ } else if (href.pathname.indexOf(subdomain1) === 0) {
retObj.NSIncludesSubdomains = true;
retObj.Hostname = href.pathname.substring(subdomain1.length);
} else if (href.pathname.indexOf(subdomain2) === 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org