@@ -424,45 +424,6 @@ angular.module('ngResource', ['ng']).
424
424
copy = angular . copy ,
425
425
isFunction = angular . isFunction ;
426
426
427
- /**
428
- * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
429
- * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set
430
- * (pchar) allowed in path segments:
431
- * segment = *pchar
432
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
433
- * pct-encoded = "%" HEXDIG HEXDIG
434
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
435
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
436
- * / "*" / "+" / "," / ";" / "="
437
- */
438
- function encodeUriSegment ( val ) {
439
- return encodeUriQuery ( val , true ) .
440
- replace ( / % 2 6 / gi, '&' ) .
441
- replace ( / % 3 D / gi, '=' ) .
442
- replace ( / % 2 B / gi, '+' ) ;
443
- }
444
-
445
-
446
- /**
447
- * This method is intended for encoding *key* or *value* parts of query component. We need a
448
- * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
449
- * have to be encoded per http://tools.ietf.org/html/rfc3986:
450
- * query = *( pchar / "/" / "?" )
451
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
452
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
453
- * pct-encoded = "%" HEXDIG HEXDIG
454
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
455
- * / "*" / "+" / "," / ";" / "="
456
- */
457
- function encodeUriQuery ( val , pctEncodeSpaces ) {
458
- return encodeURIComponent ( val ) .
459
- replace ( / % 4 0 / gi, '@' ) .
460
- replace ( / % 3 A / gi, ':' ) .
461
- replace ( / % 2 4 / g, '$' ) .
462
- replace ( / % 2 C / gi, ',' ) .
463
- replace ( / % 2 0 / g, ( pctEncodeSpaces ? '%20' : '+' ) ) ;
464
- }
465
-
466
427
function Route ( template , defaults ) {
467
428
this . template = template ;
468
429
this . defaults = extend ( { } , provider . defaults , defaults ) ;
@@ -500,9 +461,9 @@ angular.module('ngResource', ['ng']).
500
461
val = params . hasOwnProperty ( urlParam ) ? params [ urlParam ] : self . defaults [ urlParam ] ;
501
462
if ( angular . isDefined ( val ) && val !== null ) {
502
463
if ( paramInfo . isQueryParamValue ) {
503
- encodedVal = encodeUriQuery ( val , true ) ;
464
+ encodedVal = angular . $$ encodeUriQuery( val , true ) ;
504
465
} else {
505
- encodedVal = encodeUriSegment ( val ) ;
466
+ encodedVal = angular . $$ encodeUriSegment( val ) ;
506
467
}
507
468
url = url . replace ( new RegExp ( ":" + urlParam + "(\\W|$)" , "g" ) , function ( match , p1 ) {
508
469
return encodedVal + p1 ;
0 commit comments