You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of eleventy-img v2.0.1, there is a pretty critical architectural bug related to remote images. Currently the hashes of remote images are generated using the URL, instead of the image content, and that creates a class of cache related bugs. Here is a Request For Comments on one way to solve it. Please leave your thoughts.
When returning stats for remote images, lets return a randomly generated token, and store a mapping from URL to tokens in memory. After all the remote images are downloaded, and their hashes are calculated, we do a string replace of the Token with the path of the image generated using the hash.
we store a mapping {https://images.unsplash.com/photo-1608178398319-48f814d0750c: 'C90K6oSMsVss7XJ5pPpY-'} inside eleventy-img, and replace it with the actual file hash as post processing of eleventy generated images.
Please leave your comments about potential bugs you see in this system and your thoughts on improvement. Thank you.
The text was updated successfully, but these errors were encountered:
Actually it doesn't need to be random tokens. We can keep the current behaviour and just return the hash of the URL instead of a randomly generated token. Then do pretty much the same thing.
Let's provide an option to enable or disable this new behaviour and keep it disabled by default, atleast until a new major version.
As of eleventy-img v2.0.1, there is a pretty critical architectural bug related to remote images. Currently the hashes of remote images are generated using the URL, instead of the image content, and that creates a class of cache related bugs. Here is a Request For Comments on one way to solve it. Please leave your thoughts.
When returning stats for remote images, lets return a randomly generated token, and store a mapping from URL to tokens in memory. After all the remote images are downloaded, and their hashes are calculated, we do a string replace of the Token with the path of the image generated using the hash.
Example
Stealing code from the docs for this:
The output is:
we store a mapping
{https://images.unsplash.com/photo-1608178398319-48f814d0750c: 'C90K6oSMsVss7XJ5pPpY-'}
inside eleventy-img, and replace it with the actual file hash as post processing of eleventy generated images.Please leave your comments about potential bugs you see in this system and your thoughts on improvement. Thank you.
The text was updated successfully, but these errors were encountered: