(path, url, base)
| 14007 | * do not include drive names for routing. |
| 14008 | */ |
| 14009 | function removeWindowsDriveName(path, url, base) { |
| 14010 | /* |
| 14011 | Matches paths for file protocol on windows, |
| 14012 | such as /C:/foo/bar, and captures only /foo/bar. |
| 14013 | */ |
| 14014 | var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; |
| 14015 | |
| 14016 | var firstPathSegmentMatch; |
| 14017 | |
| 14018 | //Get the relative path from the input URL. |
| 14019 | if (startsWith(url, base)) { |
| 14020 | url = url.replace(base, ''); |
| 14021 | } |
| 14022 | |
| 14023 | // The input URL intentionally contains a first path segment that ends with a colon. |
| 14024 | if (windowsFilePathExp.exec(url)) { |
| 14025 | return path; |
| 14026 | } |
| 14027 | |
| 14028 | firstPathSegmentMatch = windowsFilePathExp.exec(path); |
| 14029 | return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; |
| 14030 | } |
| 14031 | }; |
| 14032 | |
| 14033 | /** |
no test coverage detected