mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-05 08:59:35 +08:00
@@ -200,7 +200,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
|
||||
Matches paths for file protocol on windows,
|
||||
such as /C:/foo/bar, and captures only /foo/bar.
|
||||
*/
|
||||
var windowsFilePathExp = /^\/?.*?:(\/.*)/;
|
||||
var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
|
||||
|
||||
var firstPathSegmentMatch;
|
||||
|
||||
@@ -209,10 +209,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
|
||||
url = url.replace(base, '');
|
||||
}
|
||||
|
||||
/*
|
||||
* The input URL intentionally contains a
|
||||
* first path segment that ends with a colon.
|
||||
*/
|
||||
// The input URL intentionally contains a first path segment that ends with a colon.
|
||||
if (windowsFilePathExp.exec(url)) {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -1539,6 +1539,16 @@ describe('$location', function() {
|
||||
expect(location.url()).toBe('/not-starting-with-slash');
|
||||
expect(location.absUrl()).toBe('http://server/pre/index.html#/not-starting-with-slash');
|
||||
});
|
||||
|
||||
|
||||
it('should not strip stuff from path just because it looks like Windows drive when its not',
|
||||
function() {
|
||||
location = new LocationHashbangUrl('http://server/pre/index.html', '#');
|
||||
|
||||
location.$$parse('http://server/pre/index.html#http%3A%2F%2Fexample.com%2F');
|
||||
expect(location.url()).toBe('/http://example.com/');
|
||||
expect(location.absUrl()).toBe('http://server/pre/index.html#/http://example.com/');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user