-
Notifications
You must be signed in to change notification settings - Fork 680
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
[BUG] background image quoted url turned into html entities #442
Comments
@zenorocha Can I work on this issue ? Can you guide me how to get started with this project ? |
Feel free to grab @heysujal |
@bukinoshita When I make a react-email-stater using Can you guide me how to go about fixing this issue once I run this in local ? |
@heysujal Can you try to place the |
@bastiaanv thank you , I am able to run it my local system . Now, I am working to find a fix for the bug. |
@haxxxton I am able to reproduce the bug now. When the inline styles has url enclosed in double quote |
@heysujal , i dont find that myself. when i do something with double quotes i end up with html entities like For example: // input
<div style={{ background: `no-repeat center bottom/contain url("${baseUrl}/foo.jpg") #000` }} /> <!-- output -->
<div style="background:no-repeat center bottom/contain url("https://example.com/foo.jpg") #000000" This then breaks the rendered output such that no background image is displayed |
I think the string template literal that you are using is causing the problem which I understand, it will be used when we have to use variables in a string. I only tested using simple quote outside url and double quote for enclosing the url which does not break the output. |
Would be great if anyone could help on this 🙏 |
@bukinoshita |
Can you ping me there again, please? I probably missed. Or maybe we can add the case here as well so other people can related to the issue. |
my work around at the moment, is a second typescript step to post-process the built file output from react-email. let me know if you'd like a gist of it.. its not the most elegant.. but it works |
Would love to see so we can fix this, if you can share |
@bukinoshita @heysujal heres the fixer ts file. i have included how i run it, and my current package.json file. it basically just does regex replacements within the file https://gist.github.com/haxxxton/1ae485b1896eed22d8f16808de696a02 |
@heysujal Can you take a look that and maybe this should be part of the |
@bukinoshita I am looking into it .My idea is to use |
A similar bug was there in Signal App which I fixed. |
Here's for reference #504. Let me know if that works |
@bukinoshita that didn't work for me. We need clear instructions on how to build the project in the local system. |
Yeah, you'll need to
|
I may be mistaken, but I think this is a Though I might ask, in what context is the <div style="background-image:url('https://www.iana.org/_img/2022/iana-logo-header.svg')"></div> It's not an email client, but I've created this JSFiddle to demonstrate that HTML entities should be cooperative for inline styles, but are not cooperative for A reference to an old spec that supports this notion:
|
The bounty is available if the problem exists |
@aliraza556 go for it my dude. I havent looked at this since i added my "fixer" script to modify the output, but i would assume it still an issue as the issue @tdg5 identified is still open |
Closing in favor of #1767 |
Some older email clients only resepect background image urls if the url is quoted (ie.
background-image: url(./foo.jpg)
will not work, butbackground-image: url("./foo.jpg")
will). When using quoted urls in provided styles, the output fromemail export
replaces either double quotes"
or single quotes'
with html entities ("
and'
respectively), breaking the inline style.Steps to reproduce:
backgroundImage: "url('path/to/my/image.jpg')"
email export
background-image: url('path/to/my/image.jpg')
The text was updated successfully, but these errors were encountered: