Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing message with _ to add a mention prepends \ in the plain text #21801

Closed
progval opened this issue Apr 14, 2022 · 1 comment
Closed

Editing message with _ to add a mention prepends \ in the plain text #21801

progval opened this issue Apr 14, 2022 · 1 comment
Labels
A-Composer A-Message-Editing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect

Comments

@progval
Copy link
Contributor

progval commented Apr 14, 2022

Steps to reproduce

  1. From https://riot.im/app/ or https://app.element.io/ join a room bridge to IRC
  2. Type abc_def
  3. Edit the message to add a mention (@val:e2e.zone in the example below)

Outcome

What did you expect?

The edit should send * val: abc_def to IRC

What happened instead?

The edit sends * val: abc\_def to IRC

This is because Element added backslashes in the edit box (escapes the underscore), which end up in the plain text field of the event, but not in the HTML field

Here is the full event:

{
  "content": {
    "body": " * val: abc\\_def",
    "format": "org.matrix.custom.html",
    "formatted_body": " * <a href=\"https://matrix.to/#/@val:e2e.zone\">val</a>: abc_def",
    "m.new_content": {
      "body": "val: abc\\_def",
      "format": "org.matrix.custom.html",
      "formatted_body": "<a href=\"https://matrix.to/#/@val:e2e.zone\">val</a>: abc_def",
      "msgtype": "m.text",
      "org.matrix.msc1767.message": [
        {
          "body": "val: abc\\_def",
          "mimetype": "text/plain"
        },
        {
          "body": "<a href=\"https://matrix.to/#/@val:e2e.zone\">val</a>: abc_def",
          "mimetype": "text/html"
        }
      ]
    },
    "m.relates_to": {
      "event_id": "$XBMc28MHS-DXNdlOG-sbgA-mGAyNPjdyOiE1wZVrAOY",
      "rel_type": "m.replace"
    },
    "msgtype": "m.text",
    "org.matrix.msc1767.message": [
      {
        "body": " * val: abc\\_def",
        "mimetype": "text/plain"
      },
      {
        "body": " * <a href=\"https://matrix.to/#/@val:e2e.zone\">val</a>: abc_def",
        "mimetype": "text/html"
      }
    ]
  },
  "origin_server_ts": 1649949612868,
  "sender": "@pinkie:matrix.org",
  "type": "m.room.message",
  "unsigned": {},
  "event_id": "$oMBhZghlvtAQSb75w1G5rFAJcEkpHCyDKkZqAy3KSq4",
  "room_id": "!sbzvsZTdOjEpyDRhiE:libera.chat"
}

Operating system

Debian 11

Browser information

91.8.0esr

URL for webapp

both https://riot.im/app/ and https://app.element.io/

Application version

1.10.10; this does not seem to happen on 1.10.1

Homeserver

matrix.org

Will you send logs?

Yes

@progval progval changed the title Editing message with _ to add a mention prepends \ Editing message with _ to add a mention prepends \ in the plain text Apr 14, 2022
@dbkr dbkr added S-Minor Impairs non-critical functionality or suitable workarounds exist O-Occasional Affects or can be seen by some users regularly or most users rarely labels Apr 19, 2022
@t3chguy
Copy link
Member

t3chguy commented Jun 6, 2022

Closing in favour of #22456

@t3chguy t3chguy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Composer A-Message-Editing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect
Projects
None yet
Development

No branches or pull requests

5 participants