aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-02-04 07:54:52 -0800
committerJohn MacFarlane <[email protected]>2022-02-04 07:54:52 -0800
commit3dcb526b9b084976bfb5ef2f02a6bf009fd78750 (patch)
tree6f7f15fd12b99a5e9e846e33355babc634fa6e01
parent60caa0a1e1a45d81d231887072a2cab438d9847b (diff)
T.P.Class.IO.adjustImagePath: avoid double slash.
PReviously if the directory argument ended in slash, we'd get a doubled slash in the path. This may help with #7881.
-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 5d4dbc715..816d71048 100644
--- a/src/Text/Pandoc/Class/IO.hs
+++ b/src/Text/Pandoc/Class/IO.hs
@@ -53,6 +53,7 @@ import Network.URI (unEscapeString)
import System.Directory (createDirectoryIfMissing)
import System.Environment (getEnv)
import System.FilePath ((</>), takeDirectory, normalise)
+import qualified System.FilePath.Posix as Posix
import System.IO (stderr)
import System.IO.Error
import System.Random (StdGen)
@@ -234,6 +235,6 @@ adjustImagePath dir mediabag (Image attr lab (src, tit)) =
case lookupMedia (T.unpack src) mediabag of
Nothing -> Image attr lab (src, tit)
Just item ->
- let fullpath = dir <> "/" <> mediaPath item
+ let fullpath = dir Posix.</> mediaPath item
in Image attr lab (T.pack fullpath, tit)
adjustImagePath _ _ x = x