diff options
-rw-r--r-- | pandoc.cabal | 3 | ||||
-rw-r--r-- | src/Text/Pandoc/PDF.hs | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/pandoc.cabal b/pandoc.cabal index a2138d6bf..c834319a2 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -237,7 +237,8 @@ Library scientific >= 0.2 && < 0.4, vector >= 0.10 && < 0.11, hslua >= 0.3 && < 0.4, - binary >= 0.5 && < 0.8 + binary >= 0.5 && < 0.8, + SHA >= 1.6 && < 1.7 Build-Tools: alex, happy if flag(https) Build-Depends: http-client >= 0.3.2 && < 0.4, 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) |