aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Class.hs
diff options
context:
space:
mode:
authorMauro Bieg <mb21@users.noreply.github.com>2019-05-28 17:51:21 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2019-05-28 11:51:21 -0400
commit214da7217bfc86d0bbe7c0175d2e2e97a00313a5 (patch)
treed247e721e62bd8489adfc449dd7edf6644d24b61 /src/Text/Pandoc/Class.hs
parent0be83f24a9c863a8c0311d55aa9680f9f7577808 (diff)
downloadpandoc-214da7217bfc86d0bbe7c0175d2e2e97a00313a5.tar.gz
Fix handling of `file:` URL scheme in `downloadOrRead` (#5522)
Move up the pattern match to be reachable, closes #5517. Previously `file:/` URLs were handled wrongly and pandoc attempted to make HTTP requests, which failed.
Diffstat (limited to 'src/Text/Pandoc/Class.hs')
-rw-r--r--src/Text/Pandoc/Class.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs
index fb3cfa72a..8d9caa6e8 100644
--- a/src/Text/Pandoc/Class.hs
+++ b/src/Text/Pandoc/Class.hs
@@ -572,10 +572,10 @@ downloadOrRead s = do
Nothing -> openURL s' -- will throw error
(Nothing, s') ->
case parseURI s' of -- requires absolute URI
- -- We don't want to treat C:/ as a scheme:
- Just u' | length (uriScheme u') > 2 -> openURL (show u')
Just u' | uriScheme u' == "file:" ->
readLocalFile $ uriPathToPath (uriPath u')
+ -- We don't want to treat C:/ as a scheme:
+ Just u' | length (uriScheme u') > 2 -> openURL (show u')
_ -> readLocalFile fp -- get from local file system
where readLocalFile f = do
resourcePath <- getResourcePath