summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-11-14 09:09:21 +0000
committeralecpl <alec@alec.pl>2011-11-14 09:09:21 +0000
commitbe58b504312c08d22c8181258c8709817a76a6ae (patch)
tree5a61447578d49b1eb119f93a11863ec682eb05b6
parentbd34cad1f6a5e3adb9bfb99947c7d3865a216142 (diff)
- Make urlencode() compatible with PHP's rawurlencode() - fixes collapsing/expanding of folders with some special characters in name
-rw-r--r--program/js/common.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/program/js/common.js b/program/js/common.js
index 831e44a21..c13d95e3d 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -542,10 +542,17 @@ function rcube_clone_object(obj)
return out;
};
-// make a string URL safe
+// make a string URL safe (and compatible with PHP's rawurlencode())
function urlencode(str)
{
- return window.encodeURIComponent ? encodeURIComponent(str) : escape(str);
+ if (window.encodeURIComponent)
+ return encodeURIComponent(str).replace('*', '%2A');
+
+ return escape(str)
+ .replace('+', '%2B')
+ .replace('*', '%2A')
+ .replace('/', '%2F')
+ .replace('@', '%40');
};