(url, locationObj, html5Mode)
| 14428 | |
| 14429 | var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; |
| 14430 | function parseAppUrl(url, locationObj, html5Mode) { |
| 14431 | |
| 14432 | if (DOUBLE_SLASH_REGEX.test(url)) { |
| 14433 | throw $locationMinErr('badpath', 'Invalid url "{0}".', url); |
| 14434 | } |
| 14435 | |
| 14436 | var prefixed = (url.charAt(0) !== '/'); |
| 14437 | if (prefixed) { |
| 14438 | url = '/' + url; |
| 14439 | } |
| 14440 | var match = urlResolve(url); |
| 14441 | var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; |
| 14442 | locationObj.$$path = decodePath(path, html5Mode); |
| 14443 | locationObj.$$search = parseKeyValue(match.search); |
| 14444 | locationObj.$$hash = decodeURIComponent(match.hash); |
| 14445 | |
| 14446 | // make sure path starts with '/'; |
| 14447 | if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { |
| 14448 | locationObj.$$path = '/' + locationObj.$$path; |
| 14449 | } |
| 14450 | } |
| 14451 | |
| 14452 | function startsWith(str, search) { |
| 14453 | return str.slice(0, search.length) === search; |
no test coverage detected