(path, url, base)
| 10794 | * do not include drive names for routing. |
| 10795 | */ |
| 10796 | function removeWindowsDriveName(path, url, base) { |
| 10797 | /* |
| 10798 | Matches paths for file protocol on windows, |
| 10799 | such as /C:/foo/bar, and captures only /foo/bar. |
| 10800 | */ |
| 10801 | var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; |
| 10802 | |
| 10803 | var firstPathSegmentMatch; |
| 10804 | |
| 10805 | //Get the relative path from the input URL. |
| 10806 | if (url.indexOf(base) === 0) { |
| 10807 | url = url.replace(base, ''); |
| 10808 | } |
| 10809 | |
| 10810 | // The input URL intentionally contains a first path segment that ends with a colon. |
| 10811 | if (windowsFilePathExp.exec(url)) { |
| 10812 | return path; |
| 10813 | } |
| 10814 | |
| 10815 | firstPathSegmentMatch = windowsFilePathExp.exec(path); |
| 10816 | return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; |
| 10817 | } |
| 10818 | }; |
| 10819 | |
| 10820 | /** |
no outgoing calls
no test coverage detected