Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(chat) avoid emojifying URLs

Saúl Ibarra Corretgéb15f1d190dbc
diff --git a/react/features/chat/components/web/ChatMessage.js b/react/features/chat/components/web/ChatMessage.js
index 8000c17fec..45cfaf6237 100644
--- a/react/features/chat/components/web/ChatMessage.js
+++ b/react/features/chat/components/web/ChatMessage.js
@@ -26,11 +26,27 @@ class ChatMessage extends AbstractChatMessage<Props> {
const { message, t } = this.props;
const processedMessage = [];
- // content is an array of text and emoji components
- const content = toArray(this._getMessageText(), { className: 'smiley' });
+ const txt = this._getMessageText();
+
+ // Tokenize the text in order to avoid emoji substitution for URLs.
+ const tokens = txt.split(' ');
+
+ // Content is an array of text and emoji components
+ const content = [];
+
+ for (const token of tokens) {
+ if (token.includes('://')) {
+ // It contains a link, bypass the emojification.
+ content.push(token);
+ } else {
+ content.push(...toArray(token, { className: 'smiley' }));
+ }
+
+ content.push(' ');
+ }
content.forEach(i => {
- if (typeof i === 'string') {
+ if (typeof i === 'string' && i !== ' ') {
processedMessage.push(<Linkify key = { i }>{ i }</Linkify>);
} else {
processedMessage.push(i);