Skip to content

Commit 928914e

Browse files
authored
check markdown images, ensure parent is File before referencing dir (#3831)
* check markdown images, ensure parent is File before referencing dir * add check for parent
1 parent a83b7b8 commit 928914e

File tree

1 file changed

+8
-0
lines changed
  • packages/gatsby-remark-copy-linked-files/src

1 file changed

+8
-0
lines changed

packages/gatsby-remark-copy-linked-files/src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ module.exports = (
149149
return
150150
}
151151

152+
// since dir will be undefined on non-files
153+
if (
154+
markdownNode.parent &&
155+
getNode(markdownNode.parent).internal.type !== `File`
156+
) {
157+
return
158+
}
159+
152160
const imagePath = path.posix.join(
153161
getNode(markdownNode.parent).dir,
154162
image.url

0 commit comments

Comments
 (0)