on master help sign in
Correctly decode request URIs in the preview server.
commit29072a5a63940254168b9b347eb122fb30c784be authorBenedict Eastaugh <benedict@eastaugh.net> dateWed 30 Mar 2011, 00:43 (16 years ago) parent98a4869
2 files changed+3−1
hakyll.cabal+1 src/Hakyll/Web/Preview/Server.hs+2−1
hakyll.cabal+1
@@ -59,6 +59,7 @@ library
5959 snap-core >= 0.4,
6060 bytestring >= 0.9,
6161 utf8-string >= 0.3,
62+ HTTP >= 4000,
6263 tagsoup >= 0.12,
6364 hopenssl >= 1.4,
6465 unix >= 2.4,
src/Hakyll/Web/Preview/Server.hs+2−1
@@ -8,6 +8,7 @@ module Hakyll.Web.Preview.Server
88import Control.Monad.Trans (liftIO)
99import Control.Applicative ((<$>))
1010import Codec.Binary.UTF8.String
11+import Network.HTTP.Base (urlDecode)
1112import System.FilePath ((</>))
1213import System.Directory (doesFileExist)
1314
@@ -39,7 +40,7 @@ static directory preServe = do
3940 let filePath = replaceAll "\\?$" (const "") -- Remove trailing ?
4041 $ replaceAll "#[^#]*$" (const "") -- Remove #section
4142 $ replaceAll "^/" (const "") -- Remove leading /
42− $ decode $ SB.unpack uri
43+ $ urlDecode $ decode $ SB.unpack uri
4344
4445 -- Try to find the requested file
4546 r <- liftIO $ findFile $ map (directory </>) $