matrix-appservice-discord icon indicating copy to clipboard operation
matrix-appservice-discord copied to clipboard

bug: matrix->discord html escape issues

Open pacien opened this issue 5 years ago • 11 comments

15910374021372

Notice that " has been replaced with " in the second message.

matrix-appservice-discord v0.5.2

pacien avatar Jun 01 '20 18:06 pacien

Besides replies, __>:C__ is also incorrectly bridged: Matrix: 15924874217085 Discord: 15924874316963

pacien avatar Jun 18 '20 13:06 pacien

This bug might be fixed in develop, not 100% sure but 99%, will have to investigate.

Sorunome avatar Jun 18 '20 13:06 Sorunome

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.

pacien avatar Jun 18 '20 14:06 pacien

Observed this again on develop (ce5c8f9c5ea4b818e4c48d5e56350061c79c0af9). This time, it's also happening without replies.

pacien avatar Nov 16 '20 04:11 pacien

Another example observed today, still running ce5c8f9:

Sent on Matrix: 16056064859207

Bridged to Discord: 16056065021475

pacien avatar Nov 17 '20 09:11 pacien

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.

image0

pacien avatar Dec 04 '21 19:12 pacien

Matrix reply bridged to Discord with escaping issues around single quotes in replies

A single quote turns into ' in the reply embed bridged from the Matrix reply.

heinrich5991 avatar Feb 09 '22 11:02 heinrich5991

hello,

any news on this issue.

Thanks

TurBoss avatar May 28 '22 18:05 TurBoss

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.

irc-matrix-discord-apos matrix-quote-discord-single_quote_escaped

  "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 !@#$%^&amp;*()&quot;&#x27;;:,&lt;.&gt;/?",
    "msgtype": "m.text"
  }

itzexor avatar Sep 10 '22 20:09 itzexor

  "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&apos;t monitor it for ticket numbers and such"
  },

  "content": {
    "body": "test !@#$%^&*()\"';:,<.>/?",
    "format": "org.matrix.custom.html",
    "formatted_body": "test !@#$%^&amp;*()&quot;&#x27;;:,&lt;.&gt;/?",
    "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"
}

luc14n0 avatar May 23 '23 02:05 luc14n0