aboutsummaryrefslogtreecommitdiffstats
path: root/src/services.js
diff options
context:
space:
mode:
authorVojta Jina2010-10-18 20:35:31 +0100
committerIgor Minar2010-10-19 21:58:01 -0700
commita27198d52e61adb9cedde04e51bbec74e66089da (patch)
tree3bbc52653727dca6f243f84bc55b60691088146b /src/services.js
parent286d1fe434687a1c0e3ddc6cf7214896704d97b3 (diff)
downloadangular.js-a27198d52e61adb9cedde04e51bbec74e66089da.tar.bz2
Added tests for URL_MATCH and fixed issue with empty path
This commit was produced by a combination of 4 commits: - Added URL_MATCH test for basic url - Moved two tests from $location to URL_MATCH, as they should be here - Added test for host without "/" ending and fix the regexp to pass the test - Added another test for matching empty abs path ("/") and fix the regexp
Diffstat (limited to 'src/services.js')
-rw-r--r--src/services.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/services.js b/src/services.js
index a8004dd1..70d774a9 100644
--- a/src/services.js
+++ b/src/services.js
@@ -1,4 +1,4 @@
-var URL_MATCH = /^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?([^\?#]+)(\?([^#]*))?(#(.*))?$/,
+var URL_MATCH = /^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
HASH_MATCH = /^([^\?]*)?(\?([^\?]*))?$/,
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp':21},
EAGER = 'eager',
@@ -184,7 +184,7 @@ angularServiceInject("$location", function(browser) {
loc.protocol = match[1];
loc.host = match[3] || '';
loc.port = match[5] || DEFAULT_PORTS[loc.protocol] || _null;
- loc.path = match[6];
+ loc.path = match[6] || '';
loc.search = parseKeyValue(match[8]);
loc.hash = match[10] || '';