diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-12-22 11:59:07 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-12-22 11:59:07 -0800 |
commit | 811601aa8b07bd07e07759ab9d1cfdac68e5f1f6 (patch) | |
tree | b7d355d76f7ba5e6defd896401ff7a143f9fbc30 | |
parent | c4f6e6cb57e4fdda9ad59ff7220988810583ec60 (diff) | |
download | pandoc-811601aa8b07bd07e07759ab9d1cfdac68e5f1f6.tar.gz |
RTF writer: properly handle images in data URIs.
See #7771.
-rw-r--r-- | src/Text/Pandoc/Writers/RTF.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs index 063371ebc..eeef3eaf3 100644 --- a/src/Text/Pandoc/Writers/RTF.hs +++ b/src/Text/Pandoc/Writers/RTF.hs @@ -43,10 +43,11 @@ rtfEmbedImage opts x@(Image attr _ (src,_)) = catchError (do result <- P.fetchItem src case result of (imgdata, Just mime) - | mime == "image/jpeg" || mime == "image/png" -> do + | mime' <- T.takeWhile (/=';') mime + , mime' == "image/jpeg" || mime' == "image/png" -> do let bytes = map (T.pack . printf "%02x") $ B.unpack imgdata filetype <- - case mime of + case mime' of "image/jpeg" -> return "\\jpegblip" "image/png" -> return "\\pngblip" _ -> throwError $ |