diff src/mono_opt.sml @ 925:552c989c1601

Change string URLification to avoid using the empty string, which confuses Apache no2slash()
author Adam Chlipala <adamc@hcoop.net>
date Sat, 12 Sep 2009 09:31:50 -0400
parents 8e540df3294d
children ad434669f299
line wrap: on
line diff
--- a/src/mono_opt.sml	Thu Sep 10 14:55:27 2009 -0400
+++ b/src/mono_opt.sml	Sat Sep 12 09:31:50 2009 -0400
@@ -76,11 +76,19 @@
           | _ => 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)