This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1113,7 +1113,7 @@ function parseKeyValue(/**string*/keyValue) {
1113
1113
var obj = { } , key_value , key ;
1114
1114
forEach ( ( keyValue || "" ) . split ( '&' ) , function ( keyValue ) {
1115
1115
if ( keyValue ) {
1116
- key_value = keyValue . split ( '=' ) ;
1116
+ key_value = keyValue . replace ( / \+ / g , '%20' ) . split ( '=' ) ;
1117
1117
key = tryDecodeURIComponent ( key_value [ 0 ] ) ;
1118
1118
if ( isDefined ( key ) ) {
1119
1119
var val = isDefined ( key_value [ 1 ] ) ? tryDecodeURIComponent ( key_value [ 1 ] ) : true ;
Original file line number Diff line number Diff line change @@ -323,6 +323,18 @@ describe('$location', function() {
323
323
expect ( url . search ( ) ) . toEqual ( { 'i j' : '<>#' } ) ;
324
324
expect ( url . hash ( ) ) . toBe ( 'x <>#' ) ;
325
325
} ) ;
326
+
327
+ it ( 'should decode pluses as spaces in urls' , function ( ) {
328
+ url = new LocationHtml5Url ( 'http://host.com/' ) ;
329
+ url . $$parse ( 'http://host.com/?a+b=c+d' ) ;
330
+ expect ( url . search ( ) ) . toEqual ( { 'a b' :'c d' } ) ;
331
+ } ) ;
332
+
333
+ it ( 'should retain pluses when setting search queries' , function ( ) {
334
+ url . search ( { 'a+b' :'c+d' } ) ;
335
+ expect ( url . search ( ) ) . toEqual ( { 'a+b' :'c+d' } ) ;
336
+ } ) ;
337
+
326
338
} ) ;
327
339
} ) ;
328
340
You can’t perform that action at this time.
0 commit comments