From e7f8cc57866b61ed354c4c3812aaced33832a0e0 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 6 Jul 2021 10:39:47 -0700
Subject: [PATCH] T.P.PDF, convertImage: normalize paths.

This will avoid paths on Windows with mixed path separators,
which may cause problems with SVG conversion.

See #7431.
---
 src/Text/Pandoc/PDF.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index f85ef5b1f..aae3f9806 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -215,9 +215,9 @@ convertImage opts tmpdir fname = do
                  E.catch (Right pngOut <$ JP.savePngImage pngOut img) $
                      \(e :: E.SomeException) -> return (Left (tshow e))
   where
-    pngOut = replaceDirectory (replaceExtension fname ".png") tmpdir
-    pdfOut = replaceDirectory (replaceExtension fname ".pdf") tmpdir
-    svgIn = tmpdir </> fname
+    pngOut = normalise $ replaceDirectory (replaceExtension fname ".png") tmpdir
+    pdfOut = normalise $ replaceDirectory (replaceExtension fname ".pdf") tmpdir
+    svgIn = normalise $ tmpdir </> fname
     mime = getMimeType fname
     doNothing = return (Right fname)