danielmahon/gatsby-remark-relative-images

The plugin doesn't work in 2.0.2

josephmarkus opened this issue · 0 comments

Summary

Version 0.2.2 used to work ok ✅
Version 2.0.2 doesn't work at all ❌

Detail

In version 0.2.2 we noticed a couple of bugs:

Bug 1

Given the following data structure

blog
├── article-1
│   ├── index.md
│   └── header.jpg
└── article-2
    ├── index.md
    └── header.jpg

Loading article-1 may load header.jpg from article-2

The way around this?

Give unique names to images

For example

blog
├── article-1
│   ├── index.md
│   └── article-1-header.jpg
└── article-2
    ├── index.md
    └── article-2-header.jpg

Bug 2

Given the following image

images/in/some/folder/or/smth/3-secrets-to-relative-image-paths-plz-work.jpg

...has been moved to another location

images/in/some/new-folder/or/smth/3-secrets-to-relative-image-paths-plz-work.jpg

Would build in integration okay

...but then it would break in production with:

Failed to retrieve metadata from image /usr/src/app/www/images/in/some/folder/or/smth/3-secrets-to-relative-image-paths-plz-work.jpg

Notice that the path references the old image in folder and not the new image in new-folder (compare paths above)

So...

I thought I would bump the library to version 2.0.2 to fix the above issues, but now it won't work at all.

I created a small Gatsby Blog Starter repo that has steps to reproduce the issue:

https://github.com/josephmarkus/broken-gatsby-remark-relative-images

Screenshot 2021-06-18 at 09 30 35