diff options
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/Class/IO.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs index 305f07a01..5d4dbc715 100644 --- a/src/Text/Pandoc/Class/IO.hs +++ b/src/Text/Pandoc/Class/IO.hs @@ -214,13 +214,15 @@ extractMedia dir d = do return $ walk (adjustImagePath dir media) d -- | Write the contents of a media bag to a path. +-- If the path contains URI escape sequences (percent-encoding), +-- these are resolved. writeMedia :: (PandocMonad m, MonadIO m) => FilePath -> (FilePath, MimeType, BL.ByteString) -> m () writeMedia dir (fp, _mt, bs) = do -- we normalize to get proper path separators for the platform - let fullpath = normalise $ dir </> fp + let fullpath = normalise $ dir </> unEscapeString fp liftIOError (createDirectoryIfMissing True) (takeDirectory fullpath) logIOError $ BL.writeFile fullpath bs |
