summaryrefslogtreecommitdiff
path: root/src/compiler/GFServer.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-05-28 11:21:30 +0000
committerhallgren <hallgren@chalmers.se>2012-05-28 11:21:30 +0000
commitb19ae37d9c603dda1bb31b23059ef7b22bc887d8 (patch)
tree0d958ddaf7f0755283287fdb4728f513562c4955 /src/compiler/GFServer.hs
parent943652a3d2758b2b3d892053704c8c930e383b14 (diff)
GFServer.hs: apply UTF8 encoding when saving uploaded files
This fixes a bug introduced on May 16.
Diffstat (limited to 'src/compiler/GFServer.hs')
-rw-r--r--src/compiler/GFServer.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs
index 8d92fe179..ee7b7326f 100644
--- a/src/compiler/GFServer.hs
+++ b/src/compiler/GFServer.hs
@@ -180,8 +180,7 @@ handle state0 cache execute1
return (state,json200 (jsonresult cwd ('/':dir++"/") cmd out files))
upload files =
- do let update (name,contents)= updateFile name contents
- mapM_ update files
+ do mapM_ (uncurry updateFile) files
return (state,resp204)
jsonList =
@@ -354,8 +353,9 @@ contentTypeFromExt ext =
bin t = (t,readBinaryFile)
-- * IO utilities
-updateFile path new =
+updateFile path new0 =
do old <- try $ readBinaryFile path
+ let new = encodeString new0
when (Right new/=old) $ do logPutStrLn $ "Updating "++path
seq (either (const 0) length old) $
writeBinaryFile path new