git.iko.soy/typeable/pandoc
on master help sign in
Recognize images with uppercase extensions

Fixes: #6472

commitf5d7d41cbdf02bdca04115bbe527b3a58ff67ea5 authorAlbert Krewinkel <albert@zeitkraut.de> dateSat 20 Jun 2020, 18:14 (6 years ago) parentb907d25
2 files changed+6−1
src/Text/Pandoc/Readers/Org/Shared.hs+2−1 test/Tests/Readers/Org/Inline.hs+4
src/Text/Pandoc/Readers/Org/Shared.hs+2−1
@@ -26,7 +26,8 @@ import Text.Pandoc.Shared (elemText)
2626isImageFilename :: Text -> Bool
2727isImageFilename fp = hasImageExtension && (isValid (T.unpack fp) || isKnownProtocolUri)
2828 where
29− hasImageExtension = takeExtension (T.unpack fp) `elem` imageExtensions
29+ hasImageExtension = takeExtension (T.unpack $ T.toLower fp)
30+ `elem` imageExtensions
3031 isKnownProtocolUri = any (\x -> (x <> "://") `T.isPrefixOf` fp) protocols
3132
3233 imageExtensions = [ ".jpeg", ".jpg", ".png", ".gif", ".svg" ]
test/Tests/Readers/Org/Inline.hs+4
@@ -214,6 +214,10 @@ tests =
214214 , "[[file:guinea-pig.gif]]"
215215 ] =?>
216216 para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
217+
218+ , "Uppercase extension" =:
219+ "[[file:test.PNG]]" =?>
220+ para (image "test.PNG" "" "")
217221 ]
218222
219223 , "Explicit link" =: