Commit d03d6fb7 authored by lilia's avatar lilia
Browse files

Fix autolinking for urls with non-English characters

Fixes #559

https://url.spec.whatwg.org/#url-code-points

// FREEBIE
parent 3d55f2c1
......@@ -5,6 +5,8 @@
'use strict';
window.Whisper = window.Whisper || {};
var URL_REGEX = /(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[\-A-Z0-9\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi;
Whisper.MessageView = Whisper.View.extend({
tagName: "li",
templateName: 'message',
......@@ -89,7 +91,7 @@
var content = this.$('.content');
var escaped = content.html();
content.html(escaped.replace(/\n/g, '<br>').replace(/(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi, "$1<a href='$2' target='_blank'>$2</a>"));
content.html(escaped.replace(/\n/g, '<br>').replace(URL_REGEX, "$1<a href='$2' target='_blank'>$2</a>"));
this.renderSent();
this.renderDelivered();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment