Skip to content

Commit

Permalink
remove checking parent node type
Browse files Browse the repository at this point in the history
  • Loading branch information
lee1409 committed Jun 5, 2021
1 parent ad5661e commit bccae82
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/gatsby-remark-copy-linked-files/src/index.js
Expand Up @@ -89,10 +89,7 @@ module.exports = (
// Copy linked files to the destination directory and modify the AST to point
// to new location of the files.
const visitor = link => {
if (
isRelativeUrl(link.url) &&
getNode(markdownNode.parent).internal.type === `File`
) {
if (isRelativeUrl(link.url) && getNode(markdownNode.parent).dir) {
const linkPath = path.posix.join(
getNode(markdownNode.parent).dir,
link.url
Expand Down Expand Up @@ -193,11 +190,8 @@ module.exports = (
return
}

// since dir will be undefined on non-files
if (
markdownNode.parent &&
getNode(markdownNode.parent).internal.type !== `File`
) {
// Just make sure the parent node has dir
if (markdownNode.parent && !getNode(markdownNode.parent).dir) {
return
}

Expand Down

0 comments on commit bccae82

Please sign in to comment.