(path, url, base)
| 14044 | * do not include drive names for routing. |
| 14045 | */ |
| 14046 | function removeWindowsDriveName(path, url, base) { |
| 14047 | /* |
| 14048 | Matches paths for file protocol on windows, |
| 14049 | such as /C:/foo/bar, and captures only /foo/bar. |
| 14050 | */ |
| 14051 | var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; |
| 14052 | |
| 14053 | var firstPathSegmentMatch; |
| 14054 | |
| 14055 | //Get the relative path from the input URL. |
| 14056 | if (startsWith(url, base)) { |
| 14057 | url = url.replace(base, ''); |
| 14058 | } |
| 14059 | |
| 14060 | // The input URL intentionally contains a first path segment that ends with a colon. |
| 14061 | if (windowsFilePathExp.exec(url)) { |
| 14062 | return path; |
| 14063 | } |
| 14064 | |
| 14065 | firstPathSegmentMatch = windowsFilePathExp.exec(path); |
| 14066 | return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; |
| 14067 | } |
| 14068 | }; |
| 14069 | |
| 14070 | /** |
no test coverage detected