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 | 1273fb96a25f6f0521b27d97ccb92d0d82668f0f (patch) | |
tree | 3bd9d7c2e18155700eee1879cdc36505ce3431d1 /lib | |
parent | f8f8014ff5b8f7edb115f88c3ae8e29757ac5f93 (diff) |
Change string URLification to avoid using the empty string, which confuses Apache no2slash()
Diffstat (limited to 'lib')
-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"), " ")); } |