-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
fix(build): use base64 for inline SVG if it contains both single and double quotes #15271
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@chaejunlee that is flaky test, sorry about that. You can ignore it. |
The ci is passing now but I had this error at the 7ca9ce3 . If these are not one of the flaky ci tests, I'll look into fixing them. |
1598d50
to
e6605ab
Compare
Because my fix kept failing on the ci, I thought my branch was behind the updates. Out of habit, I rebased and force pushed instead of merging upstream. Now the commit log looks a little weird. I should've merged and will stick to that from next time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
fixes #15257
After series of experimentation, just escaping single-quote with encoded strings doesn't work (i.e.
'
->%27
). I suspect that after HTML URL Decoding, it is again treated as single-quote, causing error again. So I tried to solve it by detecting attribute values with inner single-quote and changing the double-quote to%22
. Then I changed the single-quote to%27
.In other words, normal attributes like
"......"
will be changed to'......'
. Attributes like"...'...''..."
will be changed to%22...%27...%27%27...%22
.%22...%27...%27%27...%22
will be decoded and work as"...'...''..."
.Added a test as well.
This problem happens because the svg is being inlined.
However, it looks like just setting
assetsInlineLimit: 0
makes the svgs to be imported which makes the problem go away.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).