MCPcopy Index your code
hub / github.com/binux/qiandao / removeWindowsDriveName

Function removeWindowsDriveName

web/static/components/angularjs/angular.js:9309–9330  ·  view source on GitHub ↗
(path, url, base)

Source from the content-addressed store, hash-verified

9307 * do not include drive names for routing.
9308 */
9309 function removeWindowsDriveName (path, url, base) {
9310 /*
9311 Matches paths for file protocol on windows,
9312 such as /C:/foo/bar, and captures only /foo/bar.
9313 */
9314 var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
9315
9316 var firstPathSegmentMatch;
9317
9318 //Get the relative path from the input URL.
9319 if (url.indexOf(base) === 0) {
9320 url = url.replace(base, '');
9321 }
9322
9323 // The input URL intentionally contains a first path segment that ends with a colon.
9324 if (windowsFilePathExp.exec(url)) {
9325 return path;
9326 }
9327
9328 firstPathSegmentMatch = windowsFilePathExp.exec(path);
9329 return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
9330 }
9331 };
9332
9333 /**

Callers 1

LocationHashbangUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected