Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Link previews doesn't update when the message is edited and link is removed

Open lashae opened this issue 10 years ago • 4 comments

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)

  1. Create a message with text: Hello it is http://www.google.com and http://www.yahoo.com and send it.
  2. As exprected Google and Yahoo previews are shown.
  3. Edit the message and remove Google link, make it: Hello it is http://www.yahoo.com and send it.
  4. As expected Google preview is removed however Yahoo preview is kept; which is OK!

Use Case 2 (bug)

  1. Create a message with text: Hello it is http://www.amazon.com and send it.
  2. As exprected Amazon preview is shown.
  3. Edit the message and remove Amazon link, make it: Hello it is nobody! and send it.
  4. Google preview is NOT removed although it's link is removed!

lashae avatar Nov 21 '16 13:11 lashae

Just for a reference -this is still broken in 0.59.3.

ondrejtichacek avatar Nov 16 '17 09:11 ondrejtichacek

@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 = []; }

maxsdw avatar Dec 14 '17 21:12 maxsdw

Seconded, and screen-capped.

reitzig avatar Jan 16 '18 15:01 reitzig

Duplicate of #2833

Hudell avatar Jun 06 '18 17:06 Hudell