aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Class
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-10-19 10:36:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-10-19 16:32:39 -0700
commit1a2f8733b645ce9c91c2eb221e0e2fb37e246c72 (patch)
tree9c4a871be58ab09b1783c8f69b1fe8336b6b4611 /src/Text/Pandoc/Class
parent9ecea0bc623d6a5b90c25f9428e3a8d2352a5ee8 (diff)
downloadpandoc-1a2f8733b645ce9c91c2eb221e0e2fb37e246c72.tar.gz
Normalize rewritten image paths with --extract-media.
This change will avoid mixed paths like this one when `--extract-media` is used with a Word file: `![](C:\Git\TIJ4\Markdown/media/image30.wmf)` Instead we'll get `![](C:\Git\TIJ4\Markdown`media`image30.wmf)`. Closes #6761.
Diffstat (limited to 'src/Text/Pandoc/Class')
-rw-r--r--src/Text/Pandoc/Class/IO.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs
index c38a37844..eecda5711 100644
--- a/src/Text/Pandoc/Class/IO.hs
+++ b/src/Text/Pandoc/Class/IO.hs
@@ -227,5 +227,6 @@ writeMedia dir mediabag subpath = do
-- returns the element unchanged otherwise.
adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
adjustImagePath dir paths (Image attr lab (src, tit))
- | unpack src `elem` paths = Image attr lab (pack dir <> "/" <> src, tit)
+ | unpack src `elem` paths
+ = Image attr lab (pack (normalise $ dir </> unpack src), tit)
adjustImagePath _ _ x = x