From ef173e224f86e74d2bbd8bb3acdc4325484b360a Mon Sep 17 00:00:00 2001 From: joe beuckman Date: Wed, 29 May 2019 18:52:51 +0200 Subject: [PATCH] feat(gatsby-remark-copy-linked-files): handle flash object tags (#14381) --- .../src/__tests__/index.js | 12 ++++++++++++ .../gatsby-remark-copy-linked-files/src/index.js | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js b/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js index 08d5f1c111886..811abb528927f 100644 --- a/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js +++ b/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js @@ -210,6 +210,18 @@ describe(`gatsby-remark-copy-linked-files`, () => { expect(fsExtra.copy).toHaveBeenCalled() }) + it(`can copy flash from object elements with the value attribute`, async () => { + const path = `myMovie.swf` + + const markdownAST = remark.parse( + `\n\n` + ) + + await plugin({ files: getFiles(path), markdownAST, markdownNode, getNode }) + + expect(fsExtra.copy).toHaveBeenCalled() + }) + it(`can copy HTML videos when some siblings are in ignore extensions`, async () => { const path = `videos/sample-video.mp4` const path1 = `images/sample-image.jpg` diff --git a/packages/gatsby-remark-copy-linked-files/src/index.js b/packages/gatsby-remark-copy-linked-files/src/index.js index 6c3eba1c6adec..782e02e3d84ea 100644 --- a/packages/gatsby-remark-copy-linked-files/src/index.js +++ b/packages/gatsby-remark-copy-linked-files/src/index.js @@ -267,6 +267,11 @@ module.exports = ( `src` ).forEach(processUrl) + // Handle flash embed tags. + extractUrlAttributeAndElement($(`object param[value]`), `value`).forEach( + processUrl + ) + // Handle a tags. extractUrlAttributeAndElement($(`a[href]`), `href`).forEach(processUrl)