When processing a message on the client, the urls in the message's urls array do not contain anything after the fragment identifier. For instance, https://test.com/#/after/fragment parses as https://test.com/#.
The client renders the HTML of messages using Autolinker.js, which does not suffer from this issue. This means links work just fine in messages, however plugins that rely on callbacks like beforeSaveMessage and renderMessage callbacks will see incomplete urls in the urls array.
I believe the source of the issue is a RegEx that isn't taking into account fragments in urls. It's located in rocketchat-lib/server/functions/sendMessage.coffee:14
Alternatively, using Autolinker.js on the server side for this purpose would parse the url correctly, but I don't know enough about it to comment on it fully.
When processing a message on the client, the urls in the message's
urls
array do not contain anything after the fragment identifier. For instance,https://test.com/#/after/fragment
parses ashttps://test.com/#
.The client renders the HTML of messages using Autolinker.js, which does not suffer from this issue. This means links work just fine in messages, however plugins that rely on callbacks like
beforeSaveMessage
andrenderMessage
callbacks will see incomplete urls in theurls
array.I believe the source of the issue is a RegEx that isn't taking into account fragments in urls. It's located in
rocketchat-lib/server/functions/sendMessage.coffee:14
By replacing this RegEx with the one found here, the fragment identifier parses correctly: https://gist.github.com/dperini/729294
Alternatively, using Autolinker.js on the server side for this purpose would parse the url correctly, but I don't know enough about it to comment on it fully.