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

Sanitizer converting font names in 'style' attribute value to lower case #289

Open
anupbhore opened this issue Sep 21, 2023 · 0 comments
Open

Comments

@anupbhore
Copy link

HTML sanitizer is converting the font names in 'style' attribute of HTML element to lower case.
This results in content rendered not using right font.

Sample Input : <p><span style="font-family:Times New Roman,Times,serif;">fourth line</span></p>
Expected Output: <p><span style="font-family:'Times New Roman' , 'Times' , serif">fourth line</span></p>
Actual output : <p><span style="font-family:'times new roman' , 'times' , serif">fourth line</span></p>

Use following code to reproduce :
public void testLowerCasingOfFont() { String text = "<p><span style=\"font-family:Times New Roman,Times,serif;\">text</span></p>"; String output = new HtmlPolicyBuilder().allowStyling().allowElements("p", "span").allowAttributes("style").onElements( "p").toFactory().sanitize(text); System.out.println(output); }

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