aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
authorIgor Minar2011-02-16 19:48:21 -0500
committerIgor Minar2011-02-17 23:06:53 -0800
commit9e30baad3feafc82fb2f2011fd3f21909f4ba29e (patch)
tree98bceb6601422c859b1f7cf326fdb77385593808 /src/Angular.js
parenta070ff5ad08450a1eb6375790fc90693d624e283 (diff)
downloadangular.js-9e30baad3feafc82fb2f2011fd3f21909f4ba29e.tar.bz2
resources should not over-encode chars in url path
- added encodeUriSegment that properly encodes only those chars that URI RFC requires us to encode - modified Resource to use encodeUriSegment
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 6e5786ec..2d4b1671 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -853,6 +853,23 @@ function toKeyValue(obj) {
return parts.length ? parts.join('&') : '';
}
+
+/**
+ * we need our custom mehtod because encodeURIComponent is too agressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc2396.txt with regards to the character set (pchar) allowed in path
+ * segments
+ */
+function encodeUriSegment(val) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',');
+}
+
/**
* @workInProgress
* @ngdoc directive