RocketChat / RocketChat/Rocket.Chat
Link preview in formatted code appears if message edited
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
As resolved by #5013, links posted inside formatted code blocks do not have link previews. If this message is edited however (regardless of if any change is actually made to the message or the code block or the link), a link preview is then generated, despite it still not being appropriate.
Steps to reproduce:
- Post a link in chat inside a formatted code block, eg
`https://github.com/` - Wait long enough to convince yourself a link preview is not going to appear
- Press up to edit the message, and then press enter to "edit" the message (despite making no changes)
- A link preview will appear
Expected behavior:
No link preview to appear if the edited message does not remove the link from the code block.
Actual behavior:

Server Setup Information:
- Version of Rocket.Chat Server: 0.69.2
- Operating System: Ubuntu 18.04.1 LTS
- Deployment Method: snap
- Number of Running Instances: 1
- NodeJS Version: v8.11.3
Additional context
This seems to be a pretty straightforward bug / oversight in the initial resolving of the bug, so I haven't supplied logs. If I get hung, drawn, and quartered for this oversight I'll look to change that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing issue #5013 and reproducing the edit flow with a link inside a formatted code block. Trace how edited messages are processed for link previews; done means saving an unchanged or still-code-formatted message does not generate a preview, while removing the link from the code block preserves the expected preview behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100