mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-21 02:39:31 -06:00
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.
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user