Skip to content

Commit

Permalink
feat(gatsby-remark-copy-linked-files): handle flash object tags (#14381)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeuckm authored and pieh committed May 29, 2019
1 parent 585a9d3 commit ef173e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/gatsby-remark-copy-linked-files/src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
`<object type="application/x-shockwave-flash">\n<param name="movie" value="${path}" />\n</object>`
)

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`
Expand Down
5 changes: 5 additions & 0 deletions packages/gatsby-remark-copy-linked-files/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit ef173e2

Please sign in to comment.