element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.28k stars 2.03k forks source link

HTML <br /> injected as readable text #28602

Open Sierra410 opened 4 days ago

Sierra410 commented 4 days ago

Element does not convert \n characters to <br /> (#25891), so to reliably send messages that'd properly render on all clients, markdown newline syntax has to be used explicitly. Recently, however, that started to result in readable <br /> being injected instead.

Only messages with \ character are affected, since that forces them into html mode. (#25891)

Example message:

line \* 1  
line 2

(note the two spaces a the end of the first line, which is Markdown syntax for a newline)

The message above used to result in formatted_body that looked like

line * 1<br />\nline 2

and rendered as

line * 1
line 2

on all clients.

Now, however, attempting do that injects <br /> as readable text.

That is, formatted_body looks like

line * 1&lt;br /&gt;\nline 2

and the message renders as

line * 1<br /> line 2

on all clients, including Element.

Essentially, it is now entirely impossible to send multi-line messages in markdown mode, as they're either not portable across all clients, or they're mangled.

Operating system

All Of Them

Browser information

All Of Them

URL for webapp

app.element.io

Application version

1.11.86

Homeserver

matrix.org

Will you send logs?

No

Sierra410 commented 4 days ago

The ability send multi-line message seems kinda important for a chat app, so I don't agree with the bot marking it as "S-Minor". There aren't exactly "suitable workarounds". The way it used to work was a workaround already, and now that's broken too.

I know I don't really have a say about this, but to me that sure does sound like "S-Major".