diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-09-12 09:31:50 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-09-12 09:31:50 -0400 |
commit | 4d9fd106dfcd09caedacfbd14f4c76597cc4c5a4 (patch) | |
tree | 3bd9d7c2e18155700eee1879cdc36505ce3431d1 /lib/js | |
parent | 079c22be1c6667afb0ee661bd3e0db16bc83e25a (diff) |
Change string URLification to avoid using the empty string, which confuses Apache no2slash()
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/urweb.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 251f64ba..7349d2bf 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -464,10 +464,15 @@ function pflo(s) { } function uf(s) { - return escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B"); + if (s.length == 0) + return "_"; + return (s[0] == '_' ? "_" : "") + + escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B"); } function uu(s) { + if (s.length > 0 && s[0] == '_') + s = s.substring(1); return unescape(s.replace(new RegExp ("\\+", "g"), " ")); } |