File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ var locationPrototype = {
422
422
}
423
423
424
424
var match = PATH_MATCH . exec ( url ) ;
425
- if ( match [ 1 ] || url === '' ) this . path ( decodeURI ( match [ 1 ] ) ) ;
425
+ if ( match [ 1 ] || url === '' ) this . path ( ( this . $$html5 ? decodeURI : decodeURIComponent ) ( match [ 1 ] ) ) ;
426
426
if ( match [ 2 ] || match [ 1 ] || url === '' ) this . search ( match [ 3 ] || '' ) ;
427
427
this . hash ( match [ 5 ] || '' ) ;
428
428
Original file line number Diff line number Diff line change @@ -673,6 +673,20 @@ describe('$location', function() {
673
673
locationUrl . search ( { 'q' : '4/5 6' } ) ;
674
674
expect ( locationUrl . absUrl ( ) ) . toEqual ( 'http://host.com?q=4%2F5%206' ) ;
675
675
} ) ;
676
+
677
+ it ( 'url() should decode non-component special characters in hashbang mode' , function ( ) {
678
+ var locationUrl = new LocationHashbangUrl ( 'http://host.com' , 'http://host.com' ) ;
679
+ locationUrl . $$parse ( 'http://host.com' ) ;
680
+ locationUrl . url ( '/foo%3Abar' ) ;
681
+ expect ( locationUrl . path ( ) ) . toEqual ( '/foo:bar' ) ;
682
+ } ) ;
683
+
684
+ it ( 'url() should not decode non-component special characters in html5 mode' , function ( ) {
685
+ var locationUrl = new LocationHtml5Url ( 'http://host.com' , 'http://host.com' ) ;
686
+ locationUrl . $$parse ( 'http://host.com' ) ;
687
+ locationUrl . url ( '/foo%3Abar' ) ;
688
+ expect ( locationUrl . path ( ) ) . toEqual ( '/foo%3Abar' ) ;
689
+ } ) ;
676
690
} ) ;
677
691
} ) ;
678
692
You can’t perform that action at this time.
0 commit comments