unzip once eos uploaded

This commit is contained in:
Lucy Cifferello
2022-09-15 15:32:41 -06:00
parent 8f6959684f
commit 5052d6c09d

View File

@@ -23,6 +23,7 @@ import Data.Aeson (
(.:?), (.:?),
(.=), (.=),
) )
import Data.Conduit.Zlib (ungzip)
import Data.HashMap.Internal.Strict ( import Data.HashMap.Internal.Strict (
HashMap, HashMap,
differenceWith, differenceWith,
@@ -192,7 +193,7 @@ postEosUploadR = do
createDirectoryIfMissing True resourcesTemp createDirectoryIfMissing True resourcesTemp
withTempDirectory resourcesTemp "neweos" $ \dir -> do withTempDirectory resourcesTemp "neweos" $ \dir -> do
let path = dir </> "eos" <.> "img" let path = dir </> "eos" <.> "img"
runConduit $ rawRequestBody .| sinkFile path runConduit $ rawRequestBody .| ungzip .| sinkFile path
void . runDB $ upsert (EosHash version hash) [EosHashHash =. hash] void . runDB $ upsert (EosHash version hash) [EosHashHash =. hash]
let targetPath = root </> show version let targetPath = root </> show version
removePathForcibly targetPath removePathForcibly targetPath