element-hq / element-hq/element-web

Message HTML is double-unescaped

Open
#31,438 5 comments 0 reactions 0 assignees View on GitHub
A-Timeline O-Occasional S-Minor T-Defect
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

Send a message containing this HTML:
```
literal & &

&

```
(message event JSON should look like:)
```json
"content": {
"body": "(whatever, doesn't matter)",
"format": "org.matrix.custom.html",
"formatted_body": "literal & &
&
",
"msgtype": "m.text"
},
```

### Outcome

The message should have literal instances of `&`, as that's what the HTML is written; it should look like:

But Element Web renders this as:

Image

Also happens for things like `&lt;` (i.e. escaped `<`) rendering as `<`.

(the second unescaping appears to happen after HTML parsing, so this bug doesn't result in constructing HTML not originally in messages)

### Operating system

_No response_

### Browser information

_No response_

### URL for webapp

Both app.element.io and develop.element.io

### Application version

_No response_

### Homeserver

_No response_

### Will you send logs?

Yes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.