git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1601 from jkr/windowsfix

Fix path-slashes inside archive for windows

commitfe6d43b3e0c3d7c9f4742873e33e54237f4efe9f authorJohn MacFarlane <jgm@berkeley.edu> dateSat 27 Sep 2014, 16:21 (12 years ago) parent9c4e33fa6eead7
2 files changed+2−3
src/Text/Pandoc/Readers/Docx/Parse.hs+1−1 tests/Tests/Readers/Docx.hs+1−2
src/Text/Pandoc/Readers/Docx/Parse.hs+1−1
@@ -584,7 +584,7 @@ expandDrawingId s = do
584584 target <- asks (lookupRelationship s . envRelationships)
585585 case target of
586586 Just filepath -> do
587− bytes <- asks (lookup (combine "word" filepath) . envMedia)
587+ bytes <- asks (lookup ("word/" ++ filepath) . envMedia)
588588 case bytes of
589589 Just bs -> return (filepath, bs)
590590 Nothing -> throwError DocxError
tests/Tests/Readers/Docx.hs+1−2
@@ -13,7 +13,6 @@ import Text.Pandoc.Writers.Native (writeNative)
1313import qualified Data.Map as M
1414import Text.Pandoc.MediaBag (MediaBag, lookupMedia, mediaDirectory)
1515import Codec.Archive.Zip
16−import System.FilePath (combine)
1716
1817-- We define a wrapper around pandoc that doesn't normalize in the
1918-- tests. Since we do our own normalization, we want to make sure
@@ -60,7 +59,7 @@ testCompare = testCompareWithOpts def
6059getMedia :: FilePath -> FilePath -> IO (Maybe B.ByteString)
6160getMedia archivePath mediaPath = do
6261 zf <- B.readFile archivePath >>= return . toArchive
63− return $ findEntryByPath (combine "word" mediaPath) zf >>= (Just . fromEntry)
62+ return $ findEntryByPath ("word/" ++ mediaPath) zf >>= (Just . fromEntry)
6463
6564compareMediaPathIO :: FilePath -> MediaBag -> FilePath -> IO Bool
6665compareMediaPathIO mediaPath mediaBag docxPath = do