This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
200
200
Matches paths for file protocol on windows,
201
201
such as /C:/foo/bar, and captures only /foo/bar.
202
202
*/
203
- var windowsFilePathExp = / ^ \/ ? . * ? : ( \/ .* ) / ;
203
+ var windowsFilePathExp = / ^ \/ [ A - Z ] : ( \/ .* ) / ;
204
204
205
205
var firstPathSegmentMatch ;
206
206
@@ -209,10 +209,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
209
209
url = url . replace ( base , '' ) ;
210
210
}
211
211
212
- /*
213
- * The input URL intentionally contains a
214
- * first path segment that ends with a colon.
215
- */
212
+ // The input URL intentionally contains a first path segment that ends with a colon.
216
213
if ( windowsFilePathExp . exec ( url ) ) {
217
214
return path ;
218
215
}
Original file line number Diff line number Diff line change @@ -1539,6 +1539,16 @@ describe('$location', function() {
1539
1539
expect ( location . url ( ) ) . toBe ( '/not-starting-with-slash' ) ;
1540
1540
expect ( location . absUrl ( ) ) . toBe ( 'http://server/pre/index.html#/not-starting-with-slash' ) ;
1541
1541
} ) ;
1542
+
1543
+
1544
+ it ( 'should not strip stuff from path just because it looks like Windows drive when its not' ,
1545
+ function ( ) {
1546
+ location = new LocationHashbangUrl ( 'http://server/pre/index.html' , '#' ) ;
1547
+
1548
+ location . $$parse ( 'http://server/pre/index.html#http%3A%2F%2Fexample.com%2F' ) ;
1549
+ expect ( location . url ( ) ) . toBe ( '/http://example.com/' ) ;
1550
+ expect ( location . absUrl ( ) ) . toBe ( 'http://server/pre/index.html#/http://example.com/' ) ;
1551
+ } ) ;
1542
1552
} ) ;
1543
1553
1544
1554
You can’t perform that action at this time.
0 commit comments