From 4d9fd106dfcd09caedacfbd14f4c76597cc4c5a4 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 12 Sep 2009 09:31:50 -0400 Subject: Change string URLification to avoid using the empty string, which confuses Apache no2slash() --- src/mono_opt.sml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/mono_opt.sml') 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) -- cgit v1.2.3