webapp: Avoid encoding problems when displaying the daemon log file.

This commit is contained in:
Joey Hess 2013-11-07 15:29:20 -04:00
parent 09abd29469
commit b7c15f3b60
3 changed files with 8 additions and 1 deletions

View file

@ -67,5 +67,9 @@ getLogR :: Handler Html
getLogR = page "Logs" Nothing $ do
logfile <- liftAnnex $ fromRepo gitAnnexLogFile
logs <- liftIO $ listLogs logfile
logcontent <- liftIO $ concat <$> mapM readFile logs
logcontent <- liftIO $ concat <$> mapM readlog logs
$(widgetFile "control/log")
where
readlog f = withFile f ReadMode $ \h -> do
fileEncoding h -- log may contain invalid utf-8
hClose h `after` hGetContentsStrict h