aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/SelfContained.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index 780d2de33..f1118b974 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -104,11 +104,15 @@ getItem userdata f =
if isAbsoluteURI f
then openURL f
else do
- let mime = case takeExtension f of
- ".gz" -> getMimeType $ dropExtension f
+ -- strip off trailing query or fragment part, if relative URL.
+ -- this is needed for things like cmunrm.eot?#iefix,
+ -- which is used to get old versions of IE to work with web fonts.
+ let f' = takeWhile (\c -> c /= '?' && c /= '#') f
+ let mime = case takeExtension f' of
+ ".gz" -> getMimeType $ dropExtension f'
x -> getMimeType x
- exists <- doesFileExist f
- cont <- if exists then B.readFile f else readDataFile userdata f
+ exists <- doesFileExist f'
+ cont <- if exists then B.readFile f' else readDataFile userdata f'
return (cont, mime)
getRaw :: Maybe FilePath -> String -> String -> IO (ByteString, String)