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

Double-encoding of HTML entities in certain chat messages #2378

Open
jpd236 opened this issue Dec 21, 2024 · 0 comments
Open

Double-encoding of HTML entities in certain chat messages #2378

jpd236 opened this issue Dec 21, 2024 · 0 comments

Comments

@jpd236
Copy link
Contributor

jpd236 commented Dec 21, 2024

The chat message renderer uses marked.lexer to tokenize Markdown chat messages; in some cases, we reference the resulting token.text field to obtain just the text and render it inside an HTML tag. We then have our own rendering logic. However, as noted at markedjs/marked#1737, the lexer will encode HTML entities, rather than leaving that to the renderer. React applies its own encoding for dynamic content, which results in double-encoding.

For example, sending a code block (inside backticks) with an apostrophe inside the code will result in the user-visible message containing the HTML entity for apostrophe.

We can fix this by decoding the output of marked.lexer whenever it is used.

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

No branches or pull requests

1 participant