diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-02-21 20:19:26 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-02-21 20:19:26 +0100 |
| commit | ae6a65753e57fd2e31f2fb9a0675fdc7266ad38c (patch) | |
| tree | a16174284684978612798d19fab2e05ac492aef1 /addons/mail/static/src/js/utils.js | |
| parent | 90e8da9b4f792919c14c7de1d8596bf2056f58b2 (diff) | |
| parent | dbb713c2f836892de516e8d5e313a5dab8919a56 (diff) | |
[MERGE] forward port branch 11.0 up to dbb713c2f83
Diffstat (limited to 'addons/mail/static/src/js/utils.js')
| -rw-r--r-- | addons/mail/static/src/js/utils.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/utils.js b/addons/mail/static/src/js/utils.js index 49d1705eccd..22e9a51b9dd 100644 --- a/addons/mail/static/src/js/utils.js +++ b/addons/mail/static/src/js/utils.js @@ -60,7 +60,7 @@ function _parse_and_transform(nodes, transform_function) { // 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; +var url_regexp = /\b(?:https?:\/\/\d{1,3}(?:\.\d{1,3}){3}|(?:https?:\/\/|(?:www\.))[-a-z0-9@:%._\+~#=]{2,256}\.[a-z]{2,13})\b(?:[-a-z0-9@:%_\+.~#?&//=]*)/gi; function linkify(text, attrs) { attrs = attrs || {}; if (attrs.target === undefined) { @@ -70,7 +70,7 @@ function linkify(text, attrs) { return key + '="' + _.escape(value) + '"'; }).join(' '); return text.replace(url_regexp, function (url) { - var href = (!/^(f|ht)tps?:\/\//i.test(url)) ? "http://" + url : url; + var href = (!/^https?:\/\//i.test(url)) ? "http://" + url : url; return '<a ' + attrs + ' href="' + href + '">' + url + '</a>'; }); } |
