aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index 604bc20de..9c7c3b264 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -100,12 +100,13 @@ import Text.Pandoc.Compat.Except
readDocxWithWarnings :: ReaderOptions
-> B.ByteString
-> Either PandocError (Pandoc, MediaBag, [String])
-readDocxWithWarnings opts bytes =
- case archiveToDocxWithWarnings (toArchive bytes) of
- Right (docx, warnings) -> do
+readDocxWithWarnings opts bytes
+ | Right archive <- toArchiveOrFail bytes
+ , Right (docx, warnings) <- archiveToDocxWithWarnings archive = do
(meta, blks, mediaBag) <- docxToOutput opts docx
return (Pandoc meta blks, mediaBag, warnings)
- Left _ -> Left (ParseFailure "couldn't parse docx file")
+readDocxWithWarnings _ _ =
+ Left (ParseFailure "couldn't parse docx file")
readDocx :: ReaderOptions
-> B.ByteString