From b3d015e266b3a271770d53e2242c24a857cb23c1 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Fri, 8 Feb 2019 07:31:15 -0500 Subject: 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). --- src/Text/Pandoc/Readers/Docx/Parse.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Readers') 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 -- cgit v1.2.3