Link previews doesn't update when the message is edited and link is removed
We have been using Rocket.chat as a deployed service on "Rocket.Chat Deploy" servers with the version 0.45.0.
Use Case 1 (No bug)
- Create a message with text:
Hello it is http://www.google.com and http://www.yahoo.comand send it. - As exprected Google and Yahoo previews are shown.
- Edit the message and remove Google link, make it:
Hello it is http://www.yahoo.comand send it. - As expected Google preview is removed however Yahoo preview is kept; which is OK!
Use Case 2 (bug)
- Create a message with text:
Hello it is http://www.amazon.comand send it. - As exprected Amazon preview is shown.
- Edit the message and remove Amazon link, make it:
Hello it is nobody!and send it. - Google preview is NOT removed although it's link is removed!
Just for a reference -this is still broken in 0.59.3.
@karlprieb I have a fix for this if you want to try it:
In: Rocket.Chat/packages/rocketchat-lib/server/functions/updateMessage.js
Around line 14, change this:
if (urls) {
message.urls = urls.map((url) => { return { url: url }; });
}
to this:
if (urls) {
message.urls = urls.map((url) => { return { url: url }; });
} else {
message.urls = [];
}
Seconded, and screen-capped.
Duplicate of #2833