(url, locationObj, html5Mode)
| 13633 | |
| 13634 | var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; |
| 13635 | function parseAppUrl(url, locationObj, html5Mode) { |
| 13636 | |
| 13637 | if (DOUBLE_SLASH_REGEX.test(url)) { |
| 13638 | throw $locationMinErr('badpath', 'Invalid url "{0}".', url); |
| 13639 | } |
| 13640 | |
| 13641 | var prefixed = (url.charAt(0) !== '/'); |
| 13642 | if (prefixed) { |
| 13643 | url = '/' + url; |
| 13644 | } |
| 13645 | var match = urlResolve(url); |
| 13646 | var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; |
| 13647 | locationObj.$$path = decodePath(path, html5Mode); |
| 13648 | locationObj.$$search = parseKeyValue(match.search); |
| 13649 | locationObj.$$hash = decodeURIComponent(match.hash); |
| 13650 | |
| 13651 | // make sure path starts with '/'; |
| 13652 | if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { |
| 13653 | locationObj.$$path = '/' + locationObj.$$path; |
| 13654 | } |
| 13655 | } |
| 13656 | |
| 13657 | function startsWith(str, search) { |
| 13658 | return str.slice(0, search.length) === search; |
no test coverage detected