summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-07-11 14:23:55 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2023-07-11 14:24:31 -0700
commit100473377dfa8f399f7257fdcb81cb5a888e8c2c (patch)
tree3c7464dc2e6a4c734e9734a8e518cc795e20c959 /src
parent3eaff8de8af2e927d53027f36941859624cefa23 (diff)
SelfContained: Tweak identifier generation for svgs...
so the difference between line endings between Windows and Unix is ignored. This allows test output to be deterministic across OS versions.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/SelfContained.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index 69f696558..86eb931cc 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -181,7 +181,11 @@ convertTags (t@(TagOpen tagname as):ts)
case res of
AlreadyDataURI enc -> return $ Right (x, enc)
Fetched ("image/svg+xml", bs) -> do
- let hash = T.pack (showDigest (sha1 (L.fromStrict bs)))
+ -- we filter CR in the hash to ensure that Windows
+ -- and non-Windows tests agree:
+ let hash = T.pack (showDigest
+ (sha1 (L.fromStrict
+ (B.filter (/='\r') bs))))
return $ Left (hash, parseTags (toText bs))
Fetched (mt,bs) -> return $ Right (x, makeDataURI (mt,bs))
CouldNotFetch _ -> return $ Right (x, y)