(url, locationObj, html5Mode)
| 14493 | |
| 14494 | var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; |
| 14495 | function parseAppUrl(url, locationObj, html5Mode) { |
| 14496 | |
| 14497 | if (DOUBLE_SLASH_REGEX.test(url)) { |
| 14498 | throw $locationMinErr('badpath', 'Invalid url "{0}".', url); |
| 14499 | } |
| 14500 | |
| 14501 | var prefixed = (url.charAt(0) !== '/'); |
| 14502 | if (prefixed) { |
| 14503 | url = '/' + url; |
| 14504 | } |
| 14505 | var match = urlResolve(url); |
| 14506 | var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; |
| 14507 | locationObj.$$path = decodePath(path, html5Mode); |
| 14508 | locationObj.$$search = parseKeyValue(match.search); |
| 14509 | locationObj.$$hash = decodeURIComponent(match.hash); |
| 14510 | |
| 14511 | // make sure path starts with '/'; |
| 14512 | if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { |
| 14513 | locationObj.$$path = '/' + locationObj.$$path; |
| 14514 | } |
| 14515 | } |
| 14516 | |
| 14517 | function startsWith(str, search) { |
| 14518 | return str.slice(0, search.length) === search; |
no test coverage detected