From 8b97a39907c13c257240f3849de382be9272ddee Mon Sep 17 00:00:00 2001
From: "Lucas Perais (lpe)" <lpe@odoo.com>
Date: Tue, 30 Jan 2018 16:35:24 +0100
Subject: [PATCH] [FIX] mail_template: replace local links except mailto

Before this commit, all the mailto:xx@ww.com in emails were transformed into
http://web.base.url/xx@ww.com

This was due to the url parsing of werkzeug urls.py, which definitely get the scheme
(mailto), but doesn't get the netloc of the url -- because it has no //

Ater this commit, we transform links to local ones, except if the scheme is mailto,
and the issue disappears.

OPW 807795
---
 addons/mail/models/mail_template.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py
index e0e16eeef7c7..65ffe08e1e14 100644
--- a/addons/mail/models/mail_template.py
+++ b/addons/mail/models/mail_template.py
@@ -300,7 +300,7 @@ class MailTemplate(models.Model):
 
         def _process_link(url):
             new_url = urls.url_parse(url)
-            if new_url.scheme and new_url.netloc:
+            if new_url.scheme and (new_url.netloc or new_url.scheme == 'mailto'):
                 return url
             return new_url.replace(scheme=base.scheme, netloc=base.netloc).to_url()
 
-- 
GitLab