matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
798 stars 151 forks source link

\n in formatted_body aren't ignored #815

Open Miepee opened 2 years ago

Miepee commented 2 years ago

Describe the bug \n in in a matrix' formatted_body should always be ignored by clients (and the bridge), as it's not responsible for showing line breaks (<br/> is). However, the bridge currently does not ignore it, and when sending to discord replaces the \n with a newline, even though it shouldn't

To Reproduce Steps to reproduce the behavior:

  1. Send a Matrix message whose formatted_body contains multiple \n', like the following string:
    message\n<br />\nnewline

Expected behavior

message
newline

should be the message sent to discord

Actual behavior

messsage

newline

is the message that's actually sent.

Additional context Originally discovered with the NeoChat client, as it currently does not strip \n's from formatted_body

Half-Shot commented 2 years ago

Thanks for the report. Sounds like a simple parser bug to me that we should fix!