From 56ce29e71f75a657d4b518d86c1d7084891e898e Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Thu, 4 Jul 2019 11:43:57 +0000 Subject: [PATCH] [FIX] web_editor: tel url in werkzeug parser Before 8557bcf the URLs were never rewritten for multilang, which was an error and could duplicated the number of requests on frontend. Since 8557bcf the URLs are rewritten. In Odoo the werkzeug library is used to parse the URLs (this is similar to python parsing URL but works in python2 and python3 the same), and in this particular instance it chooses that tel:800800 is website http://tel:800800 and not a telephone number. The problem is when the url uses the uri 'tel:' and only numbers as a phone number, if the user uses the global format for telephone number (with the +) or using a separator for the numbers (e.g. '-' , '/'), in these cases there are no problems parsing the url (phone number RFC: https://tools.ietf.org/html/rfc3966). This commit changes the uri 'tel:' to 'tel://' this one is correctly parsed by the werkzeug library. opw-2029844 closes #34306 closes odoo/odoo#34586 Signed-off-by: Nicolas Lempereur (nle) --- addons/web_editor/static/src/js/editor/summernote.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js index 59124d63403..cf7b370b0fa 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -2296,7 +2296,7 @@ $.summernote.pluginEvents.backColor = function (event, editor, layoutInfo, backC options.onCreateLink = function (sLinkUrl) { if (sLinkUrl.indexOf('mailto:') === 0 || sLinkUrl.indexOf('tel:') === 0) { - // pass + sLinkUrl = sLinkUrl.replace(/^tel:([0-9]+)$/, 'tel://$1'); } else if (sLinkUrl.indexOf('@') !== -1 && sLinkUrl.indexOf(':') === -1) { sLinkUrl = 'mailto:' + sLinkUrl; } else if (sLinkUrl.indexOf('://') === -1 && sLinkUrl[0] !== '/'