summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-27 11:46:02 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-27 11:46:02 -0700
commitadfb217622a482ad716d9e65e48caef38f7c3654 (patch)
tree57ee807627e2978e716b0abb3a89a560c51a1941 /src
parentc99e057d8efe819512b5cd8c26dfc161e33b7031 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/MIME.hs4
-rw-r--r--src/Text/Pandoc/Shared.hs1
2 files changed, 4 insertions, 1 deletions
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