matrix-appservice-discord
matrix-appservice-discord copied to clipboard
bug: matrix->discord html escape issues

Notice that " has been replaced with " in the second message.
matrix-appservice-discord v0.5.2
Besides replies, __>:C__ is also incorrectly bridged:
Matrix:
Discord: 
This bug might be fixed in develop, not 100% sure but 99%, will have to investigate.
The two examples above seem to be correctly bridged to Discord on develop.
I'll re-open this issue if I notice new instances of the bug.
Observed this again on develop (ce5c8f9c5ea4b818e4c48d5e56350061c79c0af9).
This time, it's also happening without replies.
Another example observed today, still running ce5c8f9:
Sent on Matrix:

Bridged to Discord:

The issue appeared again today. It seems to happen in specific cases. Here the symbols are incorrectly transmitted when some user replied from Telegram to a message posted on the Discord side. The issue did not happen when replying to a Telegram message. Everything was correctly displayed on the Matrix side for both examples.


A single quote turns into ' in the reply embed bridged from the Matrix reply.
hello,
any news on this issue.
Thanks
I can confirm this bug for both IRC->Matrix->Discord messages containing single quote, and Matrix to Discord quoting where the Discord message contains a single quote. In each case the source message on Matrix is HTML formatted.
"content": {
"msgtype": "m.text",
"body": "Yeah but he doesn't monitor it for ticket numbers and such",
"format": "org.matrix.custom.html",
"formatted_body": "Yeah but he doesn't monitor it for ticket numbers and such"
},
"content": {
"body": "test !@#$%^&*()\"';:,<.>/?",
"format": "org.matrix.custom.html",
"formatted_body": "test !@#$%^&*()"';:,<.>/?",
"msgtype": "m.text"
}
"content": { "msgtype": "m.text", "body": "Yeah but he doesn't monitor it for ticket numbers and such", "format": "org.matrix.custom.html", "formatted_body": "Yeah but he doesn't monitor it for ticket numbers and such" }, "content": { "body": "test !@#$%^&*()\"';:,<.>/?", "format": "org.matrix.custom.html", "formatted_body": "test !@#$%^&*()"';:,<.>/?", "msgtype": "m.text" }
This raises the question: Should the IRC->Matrix bridge (that's what I suppose is doing it) be using "format" and "formatted_body" in the first place?
Here's the source of a message from a Matrix user:
{
"type": "m.room.message",
"room_id": "!ObauVvrgFpOgCRoBaA:opensuse.org",
"sender": "@luc14n0:opensuse.org",
"content": {
"msgtype": "m.text",
"body": "You can pass -lpthread manually, but I don't think that's what you really want."
},
"origin_server_ts": 1684685492083,
"unsigned": {
"age": 121049971
},
"event_id": "$Oeo3wMNShyhWKc8kOfo9OFxEsiVnDllQtwNloSgaKsM",
"user_id": "@luc14n0:opensuse.org",
"age": 121049971
}
As we can see, it doesn't try to format the message.
And even when a Matrix user uses an apostrophe/single quote, it's not converted:
{
"type": "m.room.message",
"sender": "@luc14n0:opensuse.org",
"content": {
"msgtype": "m.text",
"body": "Testing message with `command` and '. That's an apostrophe/single quote.",
"format": "org.matrix.custom.html",
"formatted_body": "Testing message with <code>command</code> and '. That's an apostrophe/single quote."
},
"origin_server_ts": 1684808629827,
"unsigned": {
"age": 663,
"transaction_id": "m1684808629229.2"
},
"event_id": "$IZBXKoFM8dO734yqxDBzwE3X1rG2tS7umhyWgkR9DF4",
"room_id": "!fcnmIxfgNvHewKXXDj:opensuse.org"
}