(path, url, base)
| 13266 | * do not include drive names for routing. |
| 13267 | */ |
| 13268 | function removeWindowsDriveName(path, url, base) { |
| 13269 | /* |
| 13270 | Matches paths for file protocol on windows, |
| 13271 | such as /C:/foo/bar, and captures only /foo/bar. |
| 13272 | */ |
| 13273 | var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; |
| 13274 | |
| 13275 | var firstPathSegmentMatch; |
| 13276 | |
| 13277 | //Get the relative path from the input URL. |
| 13278 | if (startsWith(url, base)) { |
| 13279 | url = url.replace(base, ''); |
| 13280 | } |
| 13281 | |
| 13282 | // The input URL intentionally contains a first path segment that ends with a colon. |
| 13283 | if (windowsFilePathExp.exec(url)) { |
| 13284 | return path; |
| 13285 | } |
| 13286 | |
| 13287 | firstPathSegmentMatch = windowsFilePathExp.exec(path); |
| 13288 | return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; |
| 13289 | } |
| 13290 | }; |
| 13291 | |
| 13292 | /** |
no test coverage detected