Skip to content

Commit

Permalink
fix(gatsby-source-contentful): Set image source format (#30103) (#30134)
Browse files Browse the repository at this point in the history
(cherry picked from commit 759ed72)

Co-authored-by: Matt Kane <matt@gatsbyjs.com>
  • Loading branch information
GatsbyJS Bot and ascorbic authored Mar 9, 2021
1 parent 043a025 commit decca5a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/gatsby-source-contentful/src/extend-node-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,18 @@ exports.extendNodeType = ({ type, store }) => {
const resolveGatsbyImageData = async (image, options) => {
if (!isImage(image)) return null

const { baseUrl, ...sourceMetadata } = getBasicImageProps(image, options)

const { baseUrl, contentType, width, height } = getBasicImageProps(
image,
options
)
let [, format] = contentType.split(`/`)
if (format === `jpeg`) {
format = `jpg`
}
const imageProps = generateImageData({
...options,
pluginName: `gatsby-source-contentful`,
sourceMetadata,
sourceMetadata: { width, height, format },
filename: baseUrl,
generateImageSource,
fit: fitMap.get(options.resizingBehavior),
Expand Down

0 comments on commit decca5a

Please sign in to comment.