diff options
author | 2009-09-12 09:31:50 -0400 | |
---|---|---|
committer | 2009-09-12 09:31:50 -0400 | |
commit | 1273fb96a25f6f0521b27d97ccb92d0d82668f0f (patch) | |
tree | 3bd9d7c2e18155700eee1879cdc36505ce3431d1 /src/mono_opt.sml | |
parent | f8f8014ff5b8f7edb115f88c3ae8e29757ac5f93 (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) |