summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-10-18 14:24:59 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2023-10-18 14:24:59 -0700
commit1529ff45e665e21623127561e7b8ce576b56de5c (patch)
tree306aa8bba84a50328c9fb961f924da253644939f
parent992bc86981e379e9b2a2913daa4ebdf9d8bec249 (diff)
Powerpoint writer: fix a corruption error...
caused when the document used both a regular png and a png in a data URI. (Similarly for any other image format.) The problem was that duplicate entries in `[Content Types].xml` were being created, one for the mime type `image/png`, one for `image/png;base64`. Closes #9113.
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint/Output.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Output.hs b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
index be7d169ca..0f06dee0d 100644
--- a/src/Text/Pandoc/Writers/Powerpoint/Output.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
@@ -923,7 +923,12 @@ registerMedia fp caption = do
let mediaInfo = MediaInfo { mInfoFilePath = fp
, mInfoLocalId = maxLocalId + 1
, mInfoGlobalId = newGlobalId
- , mInfoMimeType = mbMt
+ , mInfoMimeType =
+ case mbMt of
+ -- see #9113
+ Just t | ";base64" `T.isSuffixOf` t
+ -> T.stripSuffix ";base64" t
+ x -> x
, mInfoExt = imgExt
, mInfoCaption = (not . null) caption
}