From b7dffb59ffcf784b389bac6f4578ae071645b66d Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 21 Feb 2017 12:20:51 +0100 Subject: [PATCH] [FIX] link_tracker: convert link with ampersand Links containing HTML escaped characters, such as the ampersand `&` escaped `&` were not shortened correctly: Their redirecting URL contained the escaped value (e.g. `&`) instead of the actual character, leading to the wrong redirected URL. e.g. creating a mass-mailing with a link contains as query string ?test1=1&test2=2 were shortened with as redirect link ?test1=1&test2=2 opw-708272 --- addons/link_tracker/models/link_tracker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/link_tracker/models/link_tracker.py b/addons/link_tracker/models/link_tracker.py index 4de629fc517..dd8432f3306 100644 --- a/addons/link_tracker/models/link_tracker.py +++ b/addons/link_tracker/models/link_tracker.py @@ -8,7 +8,7 @@ from lxml import html from urllib2 import urlopen from urlparse import urljoin from urlparse import urlparse -from werkzeug import url_encode +from werkzeug import url_encode, unescape from openerp import models, fields, api, _ from openerp.tools import ustr @@ -54,7 +54,7 @@ class link_tracker(models.Model): href = match[0] long_url = match[1] - vals['url'] = long_url + vals['url'] = unescape(long_url) if not blacklist or not [s for s in blacklist if s in long_url] and not long_url.startswith(short_schema): link = self.create(vals)