diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-11-19 13:15:24 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-11-19 13:15:24 -0800 |
commit | 83b9a66bf468c0f32bd96be92bb571bd83b73903 (patch) | |
tree | b9a91e87d252eaae328a5492547d2f08b70581a0 /src/Text/Pandoc | |
parent | e290d91c93b265ce7763797a5c995d29fb683c67 (diff) | |
download | pandoc-83b9a66bf468c0f32bd96be92bb571bd83b73903.tar.gz |
Shared: Fixed bug in openURL with data: URIs.
Previously the base-64 encoded bytestring was returned.
We now decode it so it's a proper image!
This should fix parsing of data: URLs.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index d6ccdae66..8dcd88148 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -108,6 +108,7 @@ import Text.HTML.TagSoup (renderTagsOptions, RenderOptions(..), Tag(..), import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as B8 import Text.Pandoc.Compat.Monoid +import Data.ByteString.Base64 (decodeLenient) #ifdef EMBED_DATA_FILES import Text.Pandoc.Data (dataFiles) @@ -641,7 +642,7 @@ openURL u | "data:" `isPrefixOf` u = let mime = takeWhile (/=',') $ drop 5 u contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u - in return $ Right (contents, Just mime) + in return $ Right (decodeLenient contents, Just mime) #ifdef HTTP_CONDUIT | otherwise = E.try $ do req <- parseUrl u |