Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Srcset url whitespace in image filename problem #246

Open
lunatiqqc opened this issue May 30, 2021 · 0 comments
Open

Srcset url whitespace in image filename problem #246

lunatiqqc opened this issue May 30, 2021 · 0 comments

Comments

@lunatiqqc
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant