From f573d52b4374efda4ed3f32dac03daf052827733 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 29 Feb 2012 16:21:34 +0000 Subject: PGFService.hs bug fix: pattern match failure in doParse doParse was missing a branch for PGF.ParseIncomplete. Also introduced the operator .= to simply the code that builds JSON objects. --- src/compiler/GFServer.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs index f0eec5265..6525b6d28 100644 --- a/src/compiler/GFServer.hs +++ b/src/compiler/GFServer.hs @@ -303,11 +303,11 @@ serveStaticFile path = serveStaticFile' path = do let ext = takeExtension path - (t,rdFile,encode) = contentTypeFromExt ext + (t,rdFile) = contentTypeFromExt ext if ext `elem` [".cgi",".fcgi",".sh",".php"] then return $ resp400 $ "Unsupported file type: "++ext else do b <- doesFileExist path - if b then fmap (ok200' (ct t) . encode) $ rdFile path + if b then fmap (ok200' (ct t)) $ rdFile path else return (resp404 path) -- * Logging @@ -349,8 +349,9 @@ contentTypeFromExt ext = ".jpg" -> bin "image/jpg" _ -> bin "application/octet-stream" where - text subtype = ("text/"++subtype++"; charset=UTF-8",readFile,encodeString) - bin t = (t,readBinaryFile,id) + text subtype = ("text/"++subtype++"; charset=UTF-8", + fmap encodeString . readFile) + bin t = (t,readBinaryFile) -- * IO utilities updateFile path new = -- cgit v1.2.3