From 1771548646e2a1bc27f481fc738e54121ae33985 Mon Sep 17 00:00:00 2001 From: Ramiro Pastor Date: Thu, 15 Nov 2018 10:55:01 +0100 Subject: [PATCH] fixed percentDecode function in Server.SURI --- attic/Examples/Cookies.hs | 2 +- src/Happstack/Server/SURI.hs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/attic/Examples/Cookies.hs b/attic/Examples/Cookies.hs index 95b9dc1..3df99fe 100644 --- a/attic/Examples/Cookies.hs +++ b/attic/Examples/Cookies.hs @@ -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);" , " }" diff --git a/src/Happstack/Server/SURI.hs b/src/Happstack/Server/SURI.hs index d030347..b4c0bf0 100644 --- a/src/Happstack/Server/SURI.hs +++ b/src/Happstack/Server/SURI.hs @@ -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)