Skip to content

Commit 06bf16a

Browse files
ascorbicvladar
authored andcommitted
fix(gatsby-source-contentful): Set image source format (#30103)
(cherry picked from commit 759ed72)
1 parent 043a025 commit 06bf16a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/gatsby-source-contentful/src/extend-node-type.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -719,12 +719,18 @@ exports.extendNodeType = ({ type, store }) => {
719719
const resolveGatsbyImageData = async (image, options) => {
720720
if (!isImage(image)) return null
721721

722-
const { baseUrl, ...sourceMetadata } = getBasicImageProps(image, options)
723-
722+
const { baseUrl, contentType, width, height } = getBasicImageProps(
723+
image,
724+
options
725+
)
726+
let [, format] = contentType.split(`/`)
727+
if (format === `jpeg`) {
728+
format = `jpg`
729+
}
724730
const imageProps = generateImageData({
725731
...options,
726732
pluginName: `gatsby-source-contentful`,
727-
sourceMetadata,
733+
sourceMetadata: { width, height, format },
728734
filename: baseUrl,
729735
generateImageSource,
730736
fit: fitMap.get(options.resizingBehavior),

0 commit comments

Comments
 (0)