Commit 4ccc7442 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/333-dev-no-html-when-downloading-empty-note' into dev

parents 5c29c257 7e8f5be1
......@@ -14,11 +14,10 @@ Portability : POSIX
module Gargantext.Database.Admin.Types.Hyperdata.Frame
where
import Control.Lens
import Data.ByteString.Lazy (toStrict)
import Data.Text qualified as T
import Gargantext.Database.Admin.Types.Hyperdata.Prelude
import Gargantext.Prelude hiding (toStrict)
import Gargantext.Prelude ( ($), Show, Applicative(pure), IO, (.), (&), decodeUtf8 )
import Network.Wreq qualified as Wreq
------------------------------------------------------------------------
......@@ -62,7 +61,12 @@ instance ToSchema HyperdataFrame where
getHyperdataFrameContents :: HyperdataFrame -> IO Text
getHyperdataFrameContents (HyperdataFrame { _hf_base, _hf_frame_id }) = do
let path = T.concat [_hf_base, "/", _hf_frame_id, "/download"]
let path = T.intercalate "/" [_hf_base, _hf_frame_id, "download"]
-- We need to issue a request to this frame, because it might not
-- have been fetched yet and in that case codimd returns some ugly
-- HTML
-- See issue https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/333
_ <- Wreq.headWith Wreq.defaults $ T.unpack path
r <- Wreq.get $ T.unpack path
pure $ decodeUtf8 $ toStrict $ r ^. Wreq.responseBody
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment