(path, url, base)
| 10667 | * do not include drive names for routing. |
| 10668 | */ |
| 10669 | function removeWindowsDriveName(path, url, base) { |
| 10670 | /* |
| 10671 | Matches paths for file protocol on windows, |
| 10672 | such as /C:/foo/bar, and captures only /foo/bar. |
| 10673 | */ |
| 10674 | var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; |
| 10675 | |
| 10676 | var firstPathSegmentMatch; |
| 10677 | |
| 10678 | //Get the relative path from the input URL. |
| 10679 | if (url.indexOf(base) === 0) { |
| 10680 | url = url.replace(base, ''); |
| 10681 | } |
| 10682 | |
| 10683 | // The input URL intentionally contains a first path segment that ends with a colon. |
| 10684 | if (windowsFilePathExp.exec(url)) { |
| 10685 | return path; |
| 10686 | } |
| 10687 | |
| 10688 | firstPathSegmentMatch = windowsFilePathExp.exec(path); |
| 10689 | return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; |
| 10690 | } |
| 10691 | }; |
| 10692 | |
| 10693 | /** |
no test coverage detected