Skip to content

Commit

Permalink
EPUB writer: use standardized filename for cover image...
Browse files Browse the repository at this point in the history
...instead of the original name.

This avoids problems with e.g. filenames containing spaces.
Closes #10404.
  • Loading branch information
jgm committed Nov 24, 2024
1 parent 7d2bd2c commit 5f4c4ae
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Text/Pandoc/Writers/EPUB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,7 @@ createCoverPage meta metadata opts' vars cssvars writeHtml plainTitle =
Just img -> do
let fp = takeFileName img
-- retrieve cover image file
mediaPaths <- gets (map (fst . snd) . stMediaPaths)
coverImageName <- -- see #4206
if ("media/" <> fp) `elem` mediaPaths
then getMediaNextNewName (takeExtension fp)
else return fp
coverImageName <- getMediaNextNewName (takeExtension fp) -- see #4206
-- image dimensions
imgContent <- lift $ P.readFileLazy img
(coverImageWidth, coverImageHeight) <-
Expand Down

0 comments on commit 5f4c4ae

Please sign in to comment.