From 957404a91a4934fa68163d096a3c59d26881a9c2 Mon Sep 17 00:00:00 2001 From: Baptiste BEAUPLAT Date: Sun, 23 Feb 2020 14:19:24 +0100 Subject: [PATCH] Unescape html before urlencode in mailto link for RFS template (Closes: #90) --- debexpo/controllers/sponsor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debexpo/controllers/sponsor.py b/debexpo/controllers/sponsor.py index cffae857..c6978bbd 100644 --- a/debexpo/controllers/sponsor.py +++ b/debexpo/controllers/sponsor.py @@ -42,6 +42,7 @@ import struct import socket import json import urllib +from HTMLParser import HTMLParser from debexpo.lib.base import BaseController, c, config, render, session, \ redirect, url, abort, request, SubMenu, _ @@ -327,7 +328,8 @@ class SponsorController(BaseController): # This is a workaround for Thunderbird and some other clients # not handling properly '+' in the mailto body parameter. c.mailbody = render('/sponsor/rfs_template.mako') - c.mailbody = urllib.quote_plus(c.mailbody.encode('utf-8')) \ + c.mailbody = urllib.quote_plus(HTMLParser().unescape( + unicode(c.mailbody)).encode('utf-8')) \ .replace('+', '%20') return render('/sponsor/rfs_howto.mako') -- GitLab