writeMedia: unescape percent-encoding in creating file path.
Closes #7819 (problem with spaces in image filenames when creating PDFs).
This commit is contained in:
parent
2b51f54e19
commit
a6741bd555
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue