aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/MediaBag.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-12-28 16:31:54 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-12-28 16:31:54 -0800
commitd960282b105a6469c760b4308a3b81da723b7256 (patch)
tree852e55c7e42a15b6408b6d939aba69da1ad672f4 /src/Text/Pandoc/MediaBag.hs
parent7d56650e0137daf504fdd79187811f091d4eee37 (diff)
downloadpandoc-d960282b105a6469c760b4308a3b81da723b7256.tar.gz
Use `splitDirectories` istead of `splitPath`.
We were using `splitPath` in two places in the code where `splitDirectories` should have been used. This led to a test for `..` in paths in `extractMedia` failing, so that images with `..` in the path name could be extracted outside the directory specified by `extractMedia`. It also led a test for `media` in resource paths to fail in the docx reader.
Diffstat (limited to 'src/Text/Pandoc/MediaBag.hs')
-rw-r--r--src/Text/Pandoc/MediaBag.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Text/Pandoc/MediaBag.hs b/src/Text/Pandoc/MediaBag.hs
index 098e484ee..eb4f3110c 100644
--- a/src/Text/Pandoc/MediaBag.hs
+++ b/src/Text/Pandoc/MediaBag.hs
@@ -80,7 +80,7 @@ insertMedia fp mbMime contents (MediaBag mediamap) =
uri = parseURI fp
newpath = if isRelative fp
&& isNothing uri
- && ".." `notElem` splitPath fp
+ && ".." `notElem` splitDirectories fp
then T.unpack fp'
else showDigest (sha1 contents) <> "." <> ext
fallback = case takeExtension fp of