aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2014-08-11 11:20:33 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2014-08-11 11:20:33 +0100
commit9eded27e32f7f609a1c501a285f93119cdf20b9f (patch)
treea7be6fc267aec3ffc55133b650ac93b08fb032e3 /src/Text
parent1f02ff60ba742284aa69f0996f8b4f53b17aaabb (diff)
downloadpandoc-9eded27e32f7f609a1c501a285f93119cdf20b9f.tar.gz
EPUB reader: Fixed bug where filepaths weren't sufficiently normalised
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index cb5f684b2..d05c3cea2 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -169,10 +169,10 @@ getManifest archive = do
ns <- mkE "xmlns not in namespaces" (lookup "xmlns" namespaces)
as <- liftM ((map attrToPair) . elAttribs)
(findElementE (QName "rootfile" (Just ns) Nothing) docElem)
- root <- mkE "Root not found" (lookup "full-path" as)
- let rootdir = dropFileName root
+ manifestFile <- mkE "Root not found" (lookup "full-path" as)
+ let rootdir = dropFileName manifestFile
--mime <- lookup "media-type" as
- manifest <- findEntryByPathE root archive
+ manifest <- findEntryByPathE manifestFile archive
liftM ((,) rootdir) (parseXMLDocE . UTF8.toStringLazy . fromEntry $ manifest)
-- Fixup
@@ -272,7 +272,8 @@ findAttrE :: MonadError String m => QName -> Element -> m String
findAttrE q e = mkE "findAttr" $ findAttr q e
findEntryByPathE :: MonadError String m => FilePath -> Archive -> m Entry
-findEntryByPathE path a = mkE ("No entry on path: " ++ path) $ findEntryByPath path a
+findEntryByPathE (normalise -> path) a =
+ mkE ("No entry on path: " ++ path) $ findEntryByPath path a
parseXMLDocE :: MonadError String m => String -> m Element
parseXMLDocE doc = mkE "Unable to parse XML doc" $ parseXMLDoc doc