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 /src/mono_opt.sml | |
parent | 079c22be1c6667afb0ee661bd3e0db16bc83e25a (diff) |
Change string URLification to avoid using the empty string, which confuses Apache no2slash()
Diffstat (limited to 'src/mono_opt.sml')
-rw-r--r-- | src/mono_opt.sml | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mono_opt.sml b/src/mono_opt.sml index bf39b311..dd04a838 100644 --- a/src/mono_opt.sml +++ b/src/mono_opt.sml @@ -76,11 +76,19 @@ fun hexIt ch = | _ => s end -val urlifyString = String.translate (fn #" " => "+" - | ch => if Char.isAlphaNum ch then - str ch - else - "%" ^ hexIt ch) +fun urlifyString s = + case s of + "" => "_" + | _ => + (if String.sub (s, 0) = #"_" then + "_" + else + "") + ^ String.translate (fn #" " => "+" + | ch => if Char.isAlphaNum ch then + str ch + else + "%" ^ hexIt ch) s fun sqlifyInt n = #p_cast (Settings.currentDbms ()) (attrifyInt n, Settings.Int) |