summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-12-06 08:04:24 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2023-12-06 08:05:53 -0800
commit8b523749aebb67f709fe7348b412f3e5e629ceb4 (patch)
treef756b53fa6dd93938e54379c4e857e8dfe0281b7 /src/Text/Pandoc/Readers
parentdbbd70d4f8f5bc21fbb779a177a0a4901c02b9fb (diff)
Revert "Use base64 instead of base64-bytestring."
This reverts commit 6625e9655ed2bb0c4bd4dd91b5959a103deab1cb. base64 is currently buggy on 32-bit systems. Closes #9233.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/FB2.hs4
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/FB2.hs b/src/Text/Pandoc/Readers/FB2.hs
index 2844c9266..8f5a75418 100644
--- a/src/Text/Pandoc/Readers/FB2.hs
+++ b/src/Text/Pandoc/Readers/FB2.hs
@@ -25,7 +25,7 @@ TODO:
module Text.Pandoc.Readers.FB2 ( readFB2 ) where
import Control.Monad.Except (throwError)
import Control.Monad.State.Strict
-import Data.ByteString.Lazy.Base64
+import Data.ByteString.Base64.Lazy
import Data.Functor
import Data.List (intersperse)
import qualified Data.Map as M
@@ -202,7 +202,7 @@ parseBinaryElement e =
report $ IgnoredElement "binary without content-type attribute"
(Just filename, contentType) ->
insertMedia (T.unpack filename) contentType
- (decodeBase64Lenient
+ (decodeLenient
(UTF8.fromTextLazy . TL.fromStrict . strContent $ e))
-- * Type parsers
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 42e12c419..475c3fff2 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -28,7 +28,7 @@ import Control.Applicative ((<|>))
import Control.Monad (guard, mzero, unless, void)
import Control.Monad.Except (throwError, catchError)
import Control.Monad.Reader (ask, asks, lift, local, runReaderT)
-import Data.Text.Encoding.Base64 (encodeBase64)
+import Data.ByteString.Base64 (encode)
import Data.Char (isAlphaNum, isLetter)
import Data.Default (Default (..), def)
import Data.Foldable (for_)
@@ -807,7 +807,8 @@ pSvg = do
contents <- many (notFollowedBy (pCloses "svg") >> pAny)
closet <- TagClose "svg" <$ (pCloses "svg" <|> eof)
let rawText = T.strip $ renderTags' (opent : contents ++ [closet])
- let svgData = "data:image/svg+xml;base64," <> encodeBase64 rawText
+ let svgData = "data:image/svg+xml;base64," <>
+ UTF8.toText (encode $ UTF8.fromText rawText)
return $ B.imageWith (ident,cls,[]) svgData mempty mempty
pCodeWithClass :: PandocMonad m => Text -> Text -> TagParser m Inlines