This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ var locationPrototype = {
422422 }
423423
424424 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 ] ) ) ;
426426 if ( match [ 2 ] || match [ 1 ] || url === '' ) this . search ( match [ 3 ] || '' ) ;
427427 this . hash ( match [ 5 ] || '' ) ;
428428
Original file line number Diff line number Diff line change @@ -673,6 +673,20 @@ describe('$location', function() {
673673 locationUrl . search ( { 'q' : '4/5 6' } ) ;
674674 expect ( locationUrl . absUrl ( ) ) . toEqual ( 'http://host.com?q=4%2F5%206' ) ;
675675 } ) ;
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+ } ) ;
676690 } ) ;
677691 } ) ;
678692
You can’t perform that action at this time.
0 commit comments