Skip to content

Commit 759ed72

Browse files
authored
fix(gatsby-source-contentful): Set image source format (#30103)
1 parent fe4b329 commit 759ed72

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
@@ -720,12 +720,18 @@ exports.extendNodeType = ({ type, store }) => {
720720
const resolveGatsbyImageData = async (image, options) => {
721721
if (!isImage(image)) return null
722722

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

0 commit comments

Comments
 (0)