next-optimized-images icon indicating copy to clipboard operation
next-optimized-images copied to clipboard

Srcset url whitespace in image filename problem

Open lunatiqqc opened this issue 3 years ago • 0 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

lunatiqqc avatar May 30 '21 06:05 lunatiqqc