aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/ImageSize.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs
index d1aacff1c..14575244d 100644
--- a/src/Text/Pandoc/ImageSize.hs
+++ b/src/Text/Pandoc/ImageSize.hs
@@ -182,9 +182,12 @@ findJfifSize bs = do
Nothing -> fail "Did not find length record"
exifSize :: ByteString -> Maybe ImageSize
-exifSize = -- runGet ((Just <$> exifHeader) `mplus` return Nothing) .
- runGet (Just <$> exifHeader) .
- BL.fromChunks . (:[])
+exifSize = runGet (Just <$> exifHeader) . BL.fromChunks . (:[])
+-- NOTE: It would be nicer to do
+-- runGet ((Just <$> exifHeader) <|> return Nothing)
+-- which would prevent pandoc from raising an error when an exif header can't
+-- be parsed. But we only get an Alternative instance for Get in binary 0.6,
+-- and binary 0.5 ships with ghc 7.6.
exifHeader :: Get ImageSize
exifHeader = do