From c00c9391481fc4eaad53236716f4746a2a2a4fda Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 11 May 2018 12:12:46 -0700 Subject: [PATCH] Update link handling --- js/views/message_view.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/views/message_view.js b/js/views/message_view.js index 2740ed84c..d0a5f9ea0 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -19,6 +19,8 @@ window.Whisper = window.Whisper || {}; + const URL_REGEX = /(^|[\s\n]|)((?:https?|ftp):\/\/[-A-Z0-9\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi; + const ErrorIconView = Whisper.View.extend({ templateName: 'error-icon', className: 'error-icon-container', @@ -593,7 +595,11 @@ if (body.length > 0) { const escapedBody = body.html(); - body.html(Signal.HTML.render(escapedBody)); + body.html( + escapedBody + .replace(/\n/g, '
') + .replace(URL_REGEX, "$1$2") + ); } this.renderSent();