aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2019-02-08 07:31:15 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2019-02-08 09:54:10 -0500
commitb3d015e266b3a271770d53e2242c24a857cb23c1 (patch)
tree5200c92e6e98852c4d432099b19dc2c26bdc2bb4 /src
parent0719807401f1e0dad1237a12301b465fb78b833f (diff)
downloadpandoc-b3d015e266b3a271770d53e2242c24a857cb23c1.tar.gz
Docx reader: fix paths in archive to prevent Windows failure
Some paths in archives are absolute (have an opening slash) which, for reasons unknown, produces a failure in the test suite on MS Windows. This fixes that by removing the leading slash if it exists. Closes #5277 (previously closed with 4cce0ef but reopened due to this bug).
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index 3c4791e1a..16bd487f4 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -381,7 +381,12 @@ getDocumentXmlPath zf = do
filter (\e -> findAttr (QName "Type" Nothing Nothing) e ==
Just "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument")
rels
- findAttr (QName "Target" Nothing Nothing) rel
+ fp <- findAttr (QName "Target" Nothing Nothing) rel
+ -- sometimes there will be a leading slash, which windows seems to
+ -- have trouble with.
+ return $ case fp of
+ '/' : fp' -> fp'
+ _ -> fp
archiveToDocument :: Archive -> D Document
archiveToDocument zf = do