Matrix mentions don't map to Discord mentions when internally URL escaped #22

Closed
opened 2023-12-20 15:19:22 +00:00 by Ampflower · 1 comment

When a Matrix mention is internally URL-encoded, OOYE fails to forward the ping to the original account.

Examples:

Note, potentially identifiable info was replaced or redacted for the sake of privacy; it should still give a gist of what is going wrong.

Non-working example:

Within the formatted_body field of the Matrix message, <a href="<https://matrix.to/#/%40_ooye_ampflower%3Aexample.com>">Ampflower</a> fails to map to the corresponding Discord user, which in turn leads makes OOYE transform it into a link; like: [Ampflower](https://matrix.to/#/%40_ooye_ampflower%3Aexample.com)

Sample:

{
  "content": {
    "body": "Ampflower a sample message",
    "format": "org.matrix.custom.html",
    "formatted_body": "<a href=\"https://matrix.to/#/%40_ooye_ampflower%3Aexample.com\">Ampflower</a> a sample message",
    "msgtype": "m.text"
  },
  "origin_server_ts": -1,
  "room_id": "!---",
  "sender": "@---",
  "type": "m.room.message",
  "unsigned": {},
  "event_id": "$---",
  "user_id": "@---"
}

Working example:

Within the formatted_body field of the Matrix message, <a href=\"https://matrix.to/#/@_ooye_ampflower:example.com\"> maps to the Discord user, which means it mentions fine.

Sample

{
    "content": {
        "body": "One moment: ampflower (Discord) and Ampflower 🌺 to test something real quick",
        "format": "org.matrix.custom.html",
        "formatted_body": "One moment: <a href=\"https://matrix.to/#/@_discord_1:example.com\">ampflower (Discord)</a> and <a href=\"https://matrix.to/#/@_ooye_ampflower:example.com\">Ampflower 🌺</a> to test something real quick",
        "msgtype": "m.text"
    },
    "event_id": "$---",
    "origin_server_ts": -1,
    "sender": "@---",
    "type": "m.room.message",
    "unsigned": {
        "age": ---,
        "transaction_id": "---"
    }
}
When a Matrix mention is internally URL-encoded, OOYE fails to forward the ping to the original account. ## Examples: *Note, potentially identifiable info was replaced or redacted for the sake of privacy; it should still give a gist of what is going wrong.* ### Non-working example: Within the `formatted_body` field of the Matrix message, `<a href="<https://matrix.to/#/%40_ooye_ampflower%3Aexample.com>">Ampflower</a>` fails to map to the corresponding Discord user, which in turn leads makes OOYE transform it into a link; like: `[Ampflower](https://matrix.to/#/%40_ooye_ampflower%3Aexample.com)` #### Sample: ```json { "content": { "body": "Ampflower a sample message", "format": "org.matrix.custom.html", "formatted_body": "<a href=\"https://matrix.to/#/%40_ooye_ampflower%3Aexample.com\">Ampflower</a> a sample message", "msgtype": "m.text" }, "origin_server_ts": -1, "room_id": "!---", "sender": "@---", "type": "m.room.message", "unsigned": {}, "event_id": "$---", "user_id": "@---" } ``` ### Working example: Within the `formatted_body` field of the Matrix message, `<a href=\"https://matrix.to/#/@_ooye_ampflower:example.com\">` maps to the Discord user, which means it mentions fine. #### Sample ```json { "content": { "body": "One moment: ampflower (Discord) and Ampflower 🌺 to test something real quick", "format": "org.matrix.custom.html", "formatted_body": "One moment: <a href=\"https://matrix.to/#/@_discord_1:example.com\">ampflower (Discord)</a> and <a href=\"https://matrix.to/#/@_ooye_ampflower:example.com\">Ampflower 🌺</a> to test something real quick", "msgtype": "m.text" }, "event_id": "$---", "origin_server_ts": -1, "sender": "@---", "type": "m.room.message", "unsigned": { "age": ---, "transaction_id": "---" } } ```
Owner

Thanks for the report! Fixed in 83070dcf7e.

Thanks for the report! Fixed in 83070dcf7e50b3e52b0a91c9a597607c8ad67d46.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: cadence/out-of-your-element#22
No description provided.