[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
This commit is contained in:
Denis Ledoux
2017-02-21 12:26:02 +01:00
parent 3598538b57
commit b7dffb59ff
+2 -2
View File
@@ -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)