Skip to content

Commit

Permalink
check markdown images, ensure parent is File before referencing dir (#…
Browse files Browse the repository at this point in the history
…3831)

* check markdown images, ensure parent is File before referencing dir

* add check for parent
  • Loading branch information
calcsam committed Feb 4, 2018
1 parent a83b7b8 commit 928914e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/gatsby-remark-copy-linked-files/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ module.exports = (
return
}

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

const imagePath = path.posix.join(
getNode(markdownNode.parent).dir,
image.url
Expand Down

0 comments on commit 928914e

Please sign in to comment.