Skip to content

Commit

Permalink
fixed percentDecode function in Server.SURI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramiro Pastor committed Nov 15, 2018
1 parent fa46908 commit 1771548
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion attic/Examples/Cookies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ viewCookieCss = concat
, "} "
, "form { "
, " padding: 40px 60px;"
, " border: 1px solid navy; border-radius: 15px;"
, " border: 1px solid silver; border-radius: 15px;"
, " background-color: rgb(235,235,255);"
, " box-shadow: 1px 1px 5px 3px rgba(0,0,0,0.2);"
, " }"
Expand Down
5 changes: 1 addition & 4 deletions src/Happstack/Server/SURI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ a_path a (SURI u) = SURI $ u {URI.uriPath=a}
--
-- e.g. @\"hello%2Fworld\"@ -> @\"hello/world\"@
percentDecode :: String -> String
percentDecode [] = ""
percentDecode ('%':x1:x2:s) | isHexDigit x1 && isHexDigit x2 =
chr (digitToInt x1 * 16 + digitToInt x2) : percentDecode s
percentDecode (c:s) = c : percentDecode s
percentDecode = URI.unEscapeString

unEscape, unEscapeQS :: String -> String
unEscapeQS = percentDecode . map (\x->if x=='+' then ' ' else x)
Expand Down

0 comments on commit 1771548

Please sign in to comment.