diff options
| author | Didier (did) <did@odoo.com> | 2021-04-01 10:47:47 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-04-01 17:50:46 +0000 |
| commit | d825f88d96f2cc7abffe2c2d750891966cfcdd43 (patch) | |
| tree | 9e067f80f816646e1b19cc1217f5ba9b72d41234 /addons/mail/static/src/js/utils.js | |
| parent | 26976764554af3016097f1659b563e75757148e3 (diff) | |
[FIX] mail: detect a bigger range of URL in messages
Current URL regexp doesn't support special, but still valid, character like `é`,
`è`, `ỗ`, `ặ`, etc.
Url like `https://tenor.com/view/chỗgiặt-dog-smile-gif-13860250` are not going
to be matched correctly.
This commit adds the support for Latin-1 Supplement, Latin Extended-A,
Latin Extended-B and Latin Extended Additional unicode.
Some relevant stackoverflow discussion:
https://stackoverflow.com/questions/20690499/concrete-javascript-regex-for-accented-characters-diacritics
task-2088895
closes odoo/odoo#68667
X-original-commit: 1f9c171115d8bbd81d382e353f3faadab16aedfc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/utils.js')
| -rw-r--r-- | addons/mail/static/src/js/utils.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/utils.js b/addons/mail/static/src/js/utils.js index c65b4b339b3..d267623de2c 100644 --- a/addons/mail/static/src/js/utils.js +++ b/addons/mail/static/src/js/utils.js @@ -45,7 +45,8 @@ function _parseAndTransform(nodes, transformFunction) { // 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 urlRegexp = /\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; +// And further extended to include Latin-1 Supplement, Latin Extended-A, Latin Extended-B and Latin Extended Additional. +var urlRegexp = /\b(?:https?:\/\/\d{1,3}(?:\.\d{1,3}){3}|(?:https?:\/\/|(?:www\.))[-a-z0-9@:%._+~#=\u00C0-\u024F\u1E00-\u1EFF]{2,256}\.[a-z]{2,13})\b(?:[-a-z0-9@:%_+.~#?&'$//=;\u00C0-\u024F\u1E00-\u1EFF]*)/gi; /** * @param {string} text * @param {Object} [attrs={}] |
