Skip to content

Emoji will still be rendered inside URLs #23020

@fcdt

Description

@fcdt

Description:

Emoji will still be rendered even if the surrounding text is recognized as a URL.

Steps to reproduce:

  1. Open any chat, such as a direct message to yourself or a thread within a channel.
  2. Enter a url that contains a colon-delimited abbreviation for an emoji, for example

    https://example.com/?cmdNode=b8:flag_lv:b9:c2

Expected behavior:

The URL should appear in text form as I entered it and become a clickable link.

Actual behavior:

Sequences within the URL that match the colons-delimited abbreviations for emoji are rendered as such instead of text. The linked URL is still functional and does not contain the emoji, only the display is incorrect. To prevent this, the sequence between the colons must be interrupted by a space or something similar, which will break the link.

rocketBug

Server Setup Information:

  • Version of Rocket.Chat Server: 3.17.0
  • Operating System and so on are unknown to me

Client Setup Information:

  • Browser Version: Firefox 78.0.2 / 79.0 (64 Bit, tested on both machines)
  • Operating System: Ubuntu 16.04 / 19.10

Additional context:

Internal structure of the example message created above, retrieved from /api/v1/im.messages?roomid=anonymized&count=1:

{
  "messages": [
    {
      "_id": "anonymized",
      "rid": "anonymized",
      "msg": "https://example.com/?cmdNode=b8:flag_lv:b9:c2",
      "ts": "2021-08-24T09:12:13.293Z",
      "u": {
        "_id": "anonymized",
        "username": "fcdt",
        "name": "fcdt"
      },
      "_updatedAt": "2021-08-24T09:13:49.006Z",
      "urls": [
        {
          "url": "https://example.com/?cmdNode=b8:flag_lv:b9:c2",
          "meta": {
            "pageTitle": "Example Domain"
          },
          "headers": {
            "contentType": "text/html; charset=UTF-8",
            "contentLength": "648"
          },
          "parsedUrl": {
            "host": "example.com",
            "hash": null,
            "pathname": "/",
            "protocol": "https:",
            "port": null,
            "query": "cmdNode=b8:flag_lv:b9:c2",
            "search": "?cmdNode=b8:flag_lv:b9:c2",
            "hostname": "example.com"
          }
        }
      ],
      "mentions": [],
      "channels": [],
      "md": [
        {
          "type": "PARAGRAPH",
          "value": [
            {
              "type": "LINK",
              "value": {
                "src": {
                  "type": "PLAIN_TEXT",
                  "value": "https://example.com"
                },
                "label": {
                  "type": "PLAIN_TEXT",
                  "value": "https://example.com"
                }
              }
            },
            {
              "type": "PLAIN_TEXT",
              "value": "/?cmdNode=b8"
            },
            {
              "type": "EMOJI",
              "value": {
                "type": "PLAIN_TEXT",
                "value": "flag_lv"
              }
            },
            {
              "type": "PLAIN_TEXT",
              "value": "b9:c2"
            }
          ]
        }
      ],
      "editedAt": "2021-08-24T09:13:48.565Z",
      "editedBy": {
        "_id": "anonymized",
        "username": "fcdt"
      }
    }
  ],
  "count": 1,
  "offset": 0,
  "total": 1,
  "success": true
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions