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 messages to add a link mangles the link #1577

Open
progval opened this issue Jun 23, 2022 · 1 comment
Open

Editing messages to add a link mangles the link #1577

progval opened this issue Jun 23, 2022 · 1 comment
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.

Comments

@progval
Copy link
Contributor

progval commented Jun 23, 2022

Describe the bug

The diff algorithm adds stars in the middle of message diffs

To Reproduce
Steps to reproduce the behavior:

  1. Post "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet"
  2. Edit to replace "non risus" with a link (eg. to https://riot.im/app/ )

This happens on IRC:

17:09:49 <val-m> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet
17:10:07 <val-m> * elit. Sed [non risus, * non risus](https://riot., * .im/app/). Suspendisse

Expected behavior

17:09:49 <val-m> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet
17:10:07 <val-m> * elit. Sed [non risus](https://riot.im/app/). Suspendisse

or:

17:09:49 <val-m> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet
17:10:07 <val-m> non risus: https://riot.im/app/

(which would be more idiomatic)

Additional context

Here is the source of the Matrix event:

{
    "body": " * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed [non risus](https://riot.im/app/). Suspendisse lectus tortor, dignissim sit amet",
    "format": "org.matrix.custom.html",
    "formatted_body": " * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed <a href=\"https://riot.im/app/\">non risus</a>. Suspendisse lectus tortor, dignissim sit amet",
    "m.new_content": {
      "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed [non risus](https://riot.im/app/). Suspendisse lectus tortor, dignissim sit amet",
      "format": "org.matrix.custom.html",
      "formatted_body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed <a href=\"https://riot.im/app/\">non risus</a>. Suspendisse lectus tortor, dignissim sit amet",
      "msgtype": "m.text",
      "org.matrix.msc1767.message": [
        {
          "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed [non risus](https://riot.im/app/). Suspendisse lectus tortor, dignissim sit amet",
          "mimetype": "text/plain"
        },
        {
          "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed <a href=\"https://riot.im/app/\">non risus</a>. Suspendisse lectus tortor, dignissim sit amet",
          "mimetype": "text/html"
        }
      ]
    },
    "m.relates_to": {
      "event_id": "$pphdmPEyQaRoozalP-mmhafog-XIfXPo6AtCxRz8vTI",
      "rel_type": "m.replace"
    },
    "msgtype": "m.text",
    "org.matrix.msc1767.message": [
      {
        "body": " * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed [non risus](https://riot.im/app/). Suspendisse lectus tortor, dignissim sit amet",
        "mimetype": "text/plain"
      },
      {
        "body": " * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed <a href=\"https://riot.im/app/\">non risus</a>. Suspendisse lectus tortor, dignissim sit amet",
        "mimetype": "text/html"
      }
    ]
  }
@progval progval changed the title Editing messages to add a link mangles links Editing messages to add a link mangles the link Jun 24, 2022
@progval
Copy link
Contributor Author

progval commented Jul 17, 2022

another example, when removing link text:

13:36:05 <wsdjeg[m]> in other room, for example [#](#neovim:matrix.org) it is 0
13:36:15 <wsdjeg[m]> s/[//, s/](#//, s/)//

@jaller94 jaller94 added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems. label Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.
Projects
None yet
Development

No branches or pull requests

2 participants