@@ -14,6 +14,7 @@ import Text.Pandoc.Walk (walk, query)
1414import Text.Pandoc.Readers.HTML (readHtml)
1515import Text.Pandoc.Options ( ReaderOptions(..), readerTrace)
1616import Text.Pandoc.Shared (escapeURI, collapseFilePath, addMetaField)
17+import Network.URI (unEscapeString)
1718import Text.Pandoc.MediaBag (MediaBag, insertMedia)
1819import Text.Pandoc.Compat.Except (MonadError, throwError, runExcept, Except)
1920import Text.Pandoc.Compat.Monoid ((<>))
@@ -74,14 +75,15 @@ archiveToEPUB os archive = do
7475 let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty
7576 return $ docSpan <> doc
7677 mimeToReader :: MonadError PandocError m => MimeType -> FilePath -> FilePath -> m Pandoc
77− mimeToReader "application/xhtml+xml" (normalise -> root) (normalise -> path) = do
78+ mimeToReader "application/xhtml+xml" (unEscapeString -> root)
79+ (unEscapeString -> path) = do
7880 fname <- findEntryByPathE (root </> path) archive
7981 html <- either throwError return .
8082 readHtml os' .
8183 UTF8.toStringLazy $
8284 fromEntry fname
8385 return $ fixInternalReferences path html
84− mimeToReader s _ path
86+ mimeToReader s _ (unEscapeString -> path)
8587 | s `elem` imageMimes = return $ imageToPandoc path
8688 | otherwise = return $ mempty
8789