From adfb217622a482ad716d9e65e48caef38f7c3654 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 27 May 2015 11:46:02 -0700 Subject: Fixed svg handling in EPUB writer. This is a crude workaroud for #2183. A correct fix would require having openURL and fetchItem return a content encoding as well as a content type. --- src/Text/Pandoc/MIME.hs | 4 +++- src/Text/Pandoc/Shared.hs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/MIME.hs b/src/Text/Pandoc/MIME.hs index 27f7e3414..6fd9ac373 100644 --- a/src/Text/Pandoc/MIME.hs +++ b/src/Text/Pandoc/MIME.hs @@ -433,7 +433,9 @@ mimeTypesList = -- List borrowed from happstack-server. ,("sv4cpio","application/x-sv4cpio") ,("sv4crc","application/x-sv4crc") ,("svg","image/svg+xml") - ,("svgz","image/svg+xml") + -- removed for now, since it causes problems with + -- extensionFromMimeType: see #2183. + -- ,("svgz","image/svg+xml") ,("sw","chemical/x-swissprot") ,("swf","application/x-shockwave-flash") ,("swfl","application/x-shockwave-flash") diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 016cb4b65..362db2fed 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -796,6 +796,7 @@ fetchItem sourceURL s = fp = unEscapeString $ dropFragmentAndQuery s mime = case takeExtension fp of ".gz" -> getMimeType $ dropExtension fp + ".svgz" -> getMimeType $ dropExtension fp ++ ".svg" x -> getMimeType x ensureEscaped x@(_:':':'\\':_) = x -- likely windows path ensureEscaped x = escapeURIString isAllowedInURI x -- cgit v1.2.3