Skip to content
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.

Commit

Permalink
CB-8306 Fix parseUri to handle http://foo/bar?a@b.com&whatever
Browse files Browse the repository at this point in the history
http://user::word@host/ -> pass = ":word"
http://example/foo?bar@baz&bleh -> host = "example"
  • Loading branch information
jsoref committed Jan 14, 2015
1 parent b809e5d commit a6d166a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/templates/project/cordova/lib/utils.js
Expand Up @@ -162,7 +162,7 @@ _self = {
parseUri : function (str) {
var i, uri = {},
key = [ "source", "scheme", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor" ],
matcher = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(str);
matcher = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@\/]*)(?::([^@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(str);

for (i = key.length - 1; i >= 0; i--) {
uri[key[i]] = matcher[i] || "";
Expand Down
2 changes: 1 addition & 1 deletion framework/lib/utils.js
Expand Up @@ -366,7 +366,7 @@ self = module.exports = {
parseUri : function (str) {
var i, uri = {},
key = [ "source", "scheme", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor" ],
matcher = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@\/]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(str);
matcher = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@\/]*)(?::([^@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(str);

for (i = key.length - 1; i >= 0; i--) {
uri[key[i]] = matcher[i] || "";
Expand Down

0 comments on commit a6d166a

Please sign in to comment.