Skip to content

Commit

Permalink
fix(gatsby-source-wordpress): not all stored nodes are media items - …
Browse files Browse the repository at this point in the history
…protect against that (#32752)

* fix node diff log on updates

* The media item nodes var can also include file nodes which don't have these properties.
  • Loading branch information
TylerBarnes committed Aug 9, 2021
1 parent 32722f0 commit cf9c051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const pickNodeBySourceUrlOrCheerioImg = ({
// at upload time but image urls in html don't have this requirement.
// the sourceUrl may have -scaled in it but the full size image is still
// stored on the server (just not in the db)
(mediaItemNode.sourceUrl || mediaItemNode.mediaItemUrl).replace(
(mediaItemNode.sourceUrl || mediaItemNode.mediaItemUrl)?.replace(
`-scaled`,
``
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,16 @@ export const createSingleNode = async ({

const { createContentDigest } = helpers

const builtTypename = buildTypeName(typeInfo.nodesTypeName)

let remoteNode = {
...processedNode,
__typename: builtTypename,
id: id,
parent: null,
internal: {
contentDigest: createContentDigest(updatedNodeContent),
type: buildTypeName(typeInfo.nodesTypeName),
type: builtTypename,
},
}

Expand Down

0 comments on commit cf9c051

Please sign in to comment.