git.iko.soy/typeable/pandoc
on master help sign in
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.

commit0d7103de7e893002eedcc50fea7f81aae9535106 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 29 May 2021, 14:41 (5 years ago) parentc210b98
1 file changed+4−1
src/Text/Pandoc/Readers/Markdown.hs+4−1
src/Text/Pandoc/Readers/Markdown.hs+4−1
@@ -1924,7 +1924,10 @@ rebasePath :: SourcePos -> Text -> Text
19241924rebasePath pos path = do
19251925 let fp = sourceName pos
19261926 isFragment = T.take 1 path == "#"
1927− in if T.null path || isFragment || isAbsolute (T.unpack path) || isURI path
1927+ -- check for leading / because on Windows this won't be
1928+ -- recognized as absolute by isAbsolute
1929+ isAbsolutePath = isAbsolute (T.unpack path) || T.take 1 path == "/"
1930+ in if T.null path || isFragment || isAbsolutePath || isURI path
19281931 then path
19291932 else
19301933 case takeDirectory fp of