From 73e0a84142041ac17bdeb0650457f36f6af42722 Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Wed, 14 Sep 2022 15:53:12 -0600 Subject: [PATCH] unzipped in wrong fn; cleanup --- src/Cli/Cli.hs | 4 ++-- src/Handler/Admin.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Cli/Cli.hs b/src/Cli/Cli.hs index f879cf6..12d5e14 100644 --- a/src/Cli/Cli.hs +++ b/src/Cli/Cli.hs @@ -597,13 +597,14 @@ upload (Upload name mpkg shouldIndex) = do -- stream zip file -- stream zip into request body -- store on server uncomressed? +-- nice to have: progress for hashing eosUpload :: EosUpload -> IO () eosUpload (EosUpload name img version) = do PublishCfgRepo{..} <- findNameInCfg name noBody <- parseRequest ("POST " <> show publishCfgRepoLocation <> "/admin/v0/eos-upload") <&> setRequestHeaders [("accept", "text/plain")] - <&> setRequestHeaders [("Content-Type", "application/octet-stream")] + -- <&> setRequestHeaders [("Content-Type", "application/octet-stream")] <&> setRequestHeaders [("Content-Encoding", "gzip")] <&> applyBasicAuth (B8.pack publishCfgRepoUser) (B8.pack publishCfgRepoPass) hash <- hashFile @_ @SHA256 img @@ -623,7 +624,6 @@ eosUpload (EosUpload name img version) = do [("version", Just $ show version), ("hash", Just $ convertToBase Base16 hash)] withBody -- let withSource = setRequestBodySource (fromIntegral size) _ withQParams - -- let req = setRequestBodyFile compressedFilePath withQParams manager <- newTlsManager res <- runReaderT (httpLbs withQParams) manager removeFile $ compressedFilePath diff --git a/src/Handler/Admin.hs b/src/Handler/Admin.hs index 3b93ec0..038e7f7 100644 --- a/src/Handler/Admin.hs +++ b/src/Handler/Admin.hs @@ -151,7 +151,7 @@ postPkgUploadR = do createDirectoryIfMissing True resourcesTemp withTempDirectory resourcesTemp "newpkg" $ \dir -> do let path = dir "temp" <.> "s9pk" - runConduit $ rawRequestBody .| ungzip .| sinkFile path + runConduit $ rawRequestBody .| sinkFile path pool <- getsYesod appConnPool PkgRepo{..} <- ask res <- retry $ extractPkg pool path @@ -193,7 +193,7 @@ postEosUploadR = do createDirectoryIfMissing True resourcesTemp withTempDirectory resourcesTemp "neweos" $ \dir -> do let path = dir "eos" <.> "img" - runConduit $ rawRequestBody .| sinkFile path + runConduit $ rawRequestBody .| ungzip .| sinkFile path void . runDB $ upsert (EosHash version hash) [EosHashHash =. hash] let targetPath = root show version removePathForcibly targetPath