Skip to content

Commit

Permalink
Merge pull request graysonhicks#6 from harrygreen/exit-onCreateNode-e…
Browse files Browse the repository at this point in the history
…arly-if-no-url

Return from onCreateNode() early if no url
  • Loading branch information
graysonhicks committed May 24, 2019
2 parents 29af414 + 8de0757 commit 53b590a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ exports.onCreateNode = async (

let fileNode
if (node.internal.type === nodeType) {

const url = ext ? `${get(node, imagePath)}${ext}` : get(node, imagePath)
if (!url) {
return
}

try {
fileNode = await createRemoteFileNode({
url: ext ? `${get(node, imagePath)}${ext}` : get(node, imagePath),
url,
parentNodeId: node.id,
store,
cache,
Expand Down

0 comments on commit 53b590a

Please sign in to comment.