From 0d7103de7e893002eedcc50fea7f81aae9535106 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 29 May 2021 14:41:28 -0700 Subject: In rebasePath, check for absolute paths two ways. isAbsolute from FilePath doesn't return True on Windows for paths beginning with `/`, so we check that separately. --- src/Text/Pandoc/Readers/Markdown.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index bc5e3e30f..9a5e0889e 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1924,7 +1924,10 @@ rebasePath :: SourcePos -> Text -> Text rebasePath pos path = do let fp = sourceName pos isFragment = T.take 1 path == "#" - in if T.null path || isFragment || isAbsolute (T.unpack path) || isURI path + -- check for leading / because on Windows this won't be + -- recognized as absolute by isAbsolute + isAbsolutePath = isAbsolute (T.unpack path) || T.take 1 path == "/" + in if T.null path || isFragment || isAbsolutePath || isURI path then path else case takeDirectory fp of -- cgit v1.2.3