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

how to avoid the escape attributes when has allowed #139

Closed
madneal opened this issue Feb 25, 2022 · 1 comment
Closed

how to avoid the escape attributes when has allowed #139

madneal opened this issue Feb 25, 2022 · 1 comment

Comments

@madneal
Copy link

madneal commented Feb 25, 2022

for a html string

`<p style="white-space: pre-wrap;"><span style="background-image: url('aaaaaaa')"></span></p>`

If I use the policy

p := bluemonday.UGCPolicy()
p.AllowAttrs("style").OnElements("span", "p")

But the apostrophe of url attribute is still escaped. Is there any way to avoid being escaped.

image

@buro9
Copy link
Member

buro9 commented Jul 1, 2022

There is no way to avoid this, but it's also not an issue. A browser correctly parses the escaped output and the HTML is interpreted correctly and shown.

I've written a test case that uses a data-uri background image and it works fine in the two browsers I have at hand (Firefox and Chrome).

@buro9 buro9 closed this as completed in ed50dcc Jul 1, 2022
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

2 participants