Skip to content

Commit

Permalink
fix(gatsby-transformer-sharp): Pick extension from file prop (#11166)
Browse files Browse the repository at this point in the history
The resolvers for `srcSetWebp` and `srcWebp` check the extension on `image` (which is the ImageSharp node that has no `extension` prop) instead of `file` (which is the parent File node).
  • Loading branch information
stefanprobst authored and freiksenet committed Jan 24, 2019
1 parent bec66e5 commit 0a8b189
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby-transformer-sharp/src/extend-node-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const fixedNodeType = ({
resolve: ({ file, image, fieldArgs }) => {
// If the file is already in webp format or should explicitly
// be converted to webp, we do not create additional webp files
if (image.extension === `webp` || fieldArgs.toFormat === `webp`) {
if (file.extension === `webp` || fieldArgs.toFormat === `webp`) {
return null
}
const args = { ...fieldArgs, pathPrefix, toFormat: `webp` }
Expand All @@ -91,7 +91,7 @@ const fixedNodeType = ({
srcSetWebp: {
type: GraphQLString,
resolve: ({ file, image, fieldArgs }) => {
if (image.extension === `webp` || fieldArgs.toFormat === `webp`) {
if (file.extension === `webp` || fieldArgs.toFormat === `webp`) {
return null
}
const args = { ...fieldArgs, pathPrefix, toFormat: `webp` }
Expand Down

0 comments on commit 0a8b189

Please sign in to comment.