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

Fix line breaks with URLs in plaintext only messages #399

Merged

Conversation

n-peugnet
Copy link
Contributor

@n-peugnet n-peugnet commented Nov 1, 2022

This fixes an incorrect rendering behaviour in the timeline and the plaintext mode, introduced by #388, for plain text only messages that combined URLs and newlines.

For example with events of this kind:

{
  "type": "m.room.message",
  "content": {
    "body": "Test message :\n\nhttps://alink.com/that/is/longer\nhttps://ashortlink.fr\n\nEnd of message",
    "msgtype": "m.text"
  }
}

This changes makes sure that there is always only one container and no empty text Entities in the HTML message.

Timeline Before
2022-11-01-180710_541x167_scrot

Timeline After
2022-11-01-180827_541x272_scrot

Plaintext Before
2022-11-01-180713_541x167_scrot

Plaintext After
2022-11-01-180831_541x272_scrot

I am sorry for not catching this bug earlier.

This time I tried to test a lot of edge cases and it behaved properly.

By making sure that there is always only one container and no empty text
Entities.
@n-peugnet n-peugnet force-pushed the fix-breaks-plaintext-messages-with-url branch from 8a1f4fc to 9fe2888 Compare November 1, 2022 17:29
@tulir tulir merged commit 69e2dbd into tulir:master Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants