@@ -108,15 +108,15 @@ imageType img = case B.take 4 img of
108108 "%PDF" -> return Pdf
109109 "<svg" -> return Svg
110110 "<?xm"
111− | "<svg " == (B.take 5 $ last $ B.groupBy openingTag $ B.drop 7 img)
111+ | findSvgTag img
112112 -> return Svg
113113 "%!PS"
114114 | (B.take 4 $ B.drop 1 $ B.dropWhile (/=' ') img) == "EPSF"
115115 -> return Eps
116116 _ -> mzero
117− where
118− -- B.groupBy openingTag matches first "<svg" or "<html" but not "<!--"
119− openingTag x y = x == '<' && y /= '!'
117+
118+findSvgTag :: ByteString -> Bool
119+findSvgTag img = B.null $ snd (B.breakSubstring img "<svg")
120120
121121imageSize :: WriterOptions -> ByteString -> Either String ImageSize
122122imageSize opts img =