@@ -310,8 +310,9 @@ writeDocx opts doc@(Pandoc meta _) = do
310310 let relsEntry = toEntry relsPath epochtime $ renderXml rels
311311
312312 let entryFromArchive arch path =
313− (toEntry path epochtime . renderXml) `fmap`
314− parseXml arch distArchive path
313+ maybe (fail $ path ++ " corrupt or missing in reference docx")
314+ return
315+ (findEntryByPath path arch `mplus` findEntryByPath path distArchive)
315316 docPropsAppEntry <- entryFromArchive refArchive "docProps/app.xml"
316317 themeEntry <- entryFromArchive refArchive "word/theme/theme1.xml"
317318 fontTableEntry <- entryFromArchive refArchive "word/fontTable.xml"