diff options
| author | John MacFarlane <[email protected]> | 2023-01-20 11:07:14 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-01-20 11:07:14 -0800 |
| commit | dacdd0a56e105777be607de0d415c63bad4954e6 (patch) | |
| tree | 3b42db90eccbe9fc3a40ec83d7dbc26684c7bbe9 | |
| parent | 4d1d956dc8f4ba487ef35629a9c4f63ba200f7aa (diff) | |
Chunked HTML writer: Fix handling of images with absolute URLs.
Cloess #8567.
| -rw-r--r-- | src/Text/Pandoc/Writers/ChunkedHTML.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/ChunkedHTML.hs b/src/Text/Pandoc/Writers/ChunkedHTML.hs index cc84ce3d6..b20f160ce 100644 --- a/src/Text/Pandoc/Writers/ChunkedHTML.hs +++ b/src/Text/Pandoc/Writers/ChunkedHTML.hs @@ -29,6 +29,7 @@ import Text.Pandoc.MediaBag (mediaItems) import qualified Data.ByteString.Lazy as BL import Text.Pandoc.Chunks (splitIntoChunks, Chunk(..), ChunkedDoc(..), SecInfo(..), tocToList) +import Text.Pandoc.URI (isURI) import Data.Text (Text) import Data.Tree import qualified Data.Text as T @@ -99,9 +100,12 @@ writeChunkedHTML opts (Pandoc meta blocks) = do return $ fromArchive archive +-- We include in the zip only local media that is in the working directory +-- or below. addMedia :: PandocMonad m => Inline -> m Inline addMedia il@(Image _ _ (src,_)) - | fp <- normalise (T.unpack src) + | not (isURI src) + , fp <- normalise (T.unpack src) , isRelative fp , not (".." `isInfixOf` fp) = do (bs, mbMime) <- fetchItem (T.pack fp) |
