cyrilwanner / next-optimized-images

🌅 next-optimized-images automatically optimizes images used in next.js projects (jpeg, png, svg, webp and gif).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Srcset url whitespace in image filename problem

lunatiqqc opened this issue · comments

The srcset attribute does not allow for the url to contain whitespace as it will interpet the whitespace as a seperator of condition descriptors srcset developer.mozilla.org

How would I go about URI encoding my srcset urls?
I am aware that I can modify the Img component from 'react-optimized-images' to URI-encode the srcsets urls before returning but the modification will get overriden upon updating the package.

I was hoping for a way to decode the image filename before processing so that i can pass src={require(encodeURIComponent(../w h i t e s p a c e.jpg))} to the Img component from 'react-optimized-image' which complains that w%20h%20i%20t%20e%20s%20p%20a%20c%20e%20.jpg does not exist ofcourse