aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-05-28 10:40:50 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-05-28 10:41:40 -0700
commit9cf5f74e8fad9c7b898553724a37035bfc46f268 (patch)
tree434a11262eee84becd61877e713d25aede1b5240 /src
parent63865e4670c7d4e0a3873244d8a1c3afe12ebb2a (diff)
downloadpandoc-9cf5f74e8fad9c7b898553724a37035bfc46f268.tar.gz
PDF writer: Fixed treatment of data uris for images.
Closes #1062.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/PDF.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index e4e06e6c9..bd55c565f 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -38,11 +38,11 @@ import qualified Data.ByteString as BS
import System.Exit (ExitCode (..))
import System.FilePath
import System.Directory
+import Data.Digest.Pure.SHA (showDigest, sha1)
import System.Environment
import Control.Monad (unless)
import Data.List (isInfixOf)
import Data.Maybe (fromMaybe)
-import qualified Data.ByteString.Base64 as B64
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.Definition
import Text.Pandoc.Walk (walkM)
@@ -98,7 +98,7 @@ handleImage' baseURL tmpdir (Image ils (src,tit)) = do
Right (contents, Just mime) -> do
let ext = fromMaybe (takeExtension src) $
extensionFromMimeType mime
- let basename = UTF8.toString $ B64.encode $ UTF8.fromString src
+ let basename = showDigest $ sha1 $ BL.fromChunks [contents]
let fname = tmpdir </> basename <.> ext
BS.writeFile fname contents
return $ Image ils (fname,tit)