diff options
| author | hallgren <hallgren@chalmers.se> | 2012-02-29 16:21:34 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-02-29 16:21:34 +0000 |
| commit | f573d52b4374efda4ed3f32dac03daf052827733 (patch) | |
| tree | f43736176318a182105744ccdfd7a23bb2ee989e /src/compiler/GFServer.hs | |
| parent | 4052767790cfc619eec4559f8db950a081e6bc0c (diff) | |
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.
Diffstat (limited to 'src/compiler/GFServer.hs')
| -rw-r--r-- | src/compiler/GFServer.hs | 9 |
1 files changed, 5 insertions, 4 deletions
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 = |
