gatsby-remark-images-contentful exposes same image to render when they should be different #23762
Labels
status: needs reproduction
This issue needs a simplified reproduction of the bug for further troubleshooting.
topic: source-contentful
Related to Gatsby's integration with Contentful
type: bug
An issue or pull request relating to a bug in Gatsby
Description
When rendering content through
gatsby-plugin-mdx
with thegatsby-remark-images-contentful
plugin, I am seeing the same image being rendered for all images in the content instead of different ones. I have narrowed this down to the image assets in Contentful images having the same file name (image.png
in my case). This results in thecacheKey
generated by the plugin to be the same for all images served from Contentful with that filename, even if they are separate assets with unique ID's in Contentful.This seems like it's a bug, as Contentful and Gatsby are separate and the former is often maintained by editors not knowing that having two image assets with the same file name might cause issues for the website. Nor should they need to care, or am I not
Steps to reproduce
Option 1 is to clone https://github.com/jkarsrud/remark-contentful-image-repro and run it in a browser to observe the bug. Replacing one of the image URL with the following in
/src/posts/test.md
will show that the file name matters;//images.ctfassets.net/wgbykpk4lo2v/1PxG4IVt7p8Y3uWG8uQgEz/bd8084807826e28d92738b147c59fd1e/andrew-neel-cckf4TsHAuw-unsplash.jpg
Option 2 is to create your own version of the repo above.
Create a Gatsby site with
gatsby-plugin-mdx
andgatsby-remark-images-contentful
. Then, create a post with the following content (Note: The images here are hosted on my personal Contentful space):Then make a page template with the following content:
Expected result
The images in the content rendered from Markdown should be different, even if the filename is the same
Actual result
The images rendered from the Markdown content are the same image.
Environment
The text was updated successfully, but these errors were encountered: