git.iko.soy/typeable/pandoc
on master help sign in
Treat argument as URI only if it has http(s) scheme.

Previously pandoc would treat the c: in some windowns filespecs as a URI scheme and try to download... Thanks to Peter Wang for pointing this out.

commitc2636e61d784e88c4a2c8916fdf564266dd7cabd authorJohn MacFarlane <jgm@berkeley.edu> dateFri 12 Nov 2010, 18:30 (16 years ago) parentca51bbb
1 file changed+4−3
src/pandoc.hs+4−3
src/pandoc.hs+4−3
@@ -51,7 +51,7 @@ import Text.Pandoc.Biblio
5151#endif
5252import Control.Monad (when, unless, liftM)
5353import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..))
54−import Network.URI (parseURI, isURI)
54+import Network.URI (parseURI, isURI, URI(..))
5555import qualified Data.ByteString.Lazy as B
5656import Data.ByteString.Lazy.UTF8 (toString, fromString)
5757import Codec.Binary.UTF8.String (decodeString, encodeString)
@@ -835,8 +835,9 @@ main = do
835835 readSources srcs = mapM readSource srcs
836836 readSource "-" = UTF8.getContents
837837 readSource src = case parseURI src of
838− Just u -> readURI u
839− Nothing -> UTF8.readFile src
838+ Just u | uriScheme u `elem` ["http:","https:"] ->
839+ readURI u
840+ _ -> UTF8.readFile src
840841 readURI uri = simpleHTTP (mkRequest GET uri) >>= getResponseBody >>=
841842 return . toString -- treat all as UTF8
842843