(path, url, base)
| 13840 | * do not include drive names for routing. |
| 13841 | */ |
| 13842 | function removeWindowsDriveName(path, url, base) { |
| 13843 | /* |
| 13844 | Matches paths for file protocol on windows, |
| 13845 | such as /C:/foo/bar, and captures only /foo/bar. |
| 13846 | */ |
| 13847 | var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; |
| 13848 | |
| 13849 | var firstPathSegmentMatch; |
| 13850 | |
| 13851 | //Get the relative path from the input URL. |
| 13852 | if (startsWith(url, base)) { |
| 13853 | url = url.replace(base, ''); |
| 13854 | } |
| 13855 | |
| 13856 | // The input URL intentionally contains a first path segment that ends with a colon. |
| 13857 | if (windowsFilePathExp.exec(url)) { |
| 13858 | return path; |
| 13859 | } |
| 13860 | |
| 13861 | firstPathSegmentMatch = windowsFilePathExp.exec(path); |
| 13862 | return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; |
| 13863 | } |
| 13864 | }; |
| 13865 | |
| 13866 | /** |
no test coverage detected