summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/utils.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-03-13 17:37:20 +0100
committerChristophe Simonis <chs@odoo.com>2017-03-13 17:37:20 +0100
commit65a5ced979821afed0711e662e2fa7f6ba8a67dd (patch)
treef5c16b95a1c71700258a74323934045d1c0de07f /addons/mail/static/src/js/utils.js
parentd5c3f360e2ca076c9b0f4debe643ed1df12a2327 (diff)
parent777a87cde8fbee8495c95891d5cb2104cf9160e6 (diff)
[MERGE] forward port branch saas-14 up to 777a87cde8f
Diffstat (limited to 'addons/mail/static/src/js/utils.js')
-rw-r--r--addons/mail/static/src/js/utils.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/utils.js b/addons/mail/static/src/js/utils.js
index 2c30a82701e..3bc730d15e8 100644
--- a/addons/mail/static/src/js/utils.js
+++ b/addons/mail/static/src/js/utils.js
@@ -59,8 +59,9 @@ function _parse_and_transform(nodes, transform_function) {
}).join("");
}
-// suggested regexp (gruber url matching regexp, adapted to js, see https://gist.github.com/gruber/8891611)
-var url_regexp = /\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;
+// Suggested URL Javascript regex of http://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url
+// Adapted to make http(s):// not required if (and only if) www. is given. So `should.notmatch` does not match.
+var url_regexp = /\b(?:https?:\/\/|(www\.))[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,13}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi;
function linkify(text, attrs) {
attrs = attrs || {};
if (attrs.target === undefined) {