From 008a450fea33f734500514c104d95411ada88594 Mon Sep 17 00:00:00 2001 From: Baptiste BEAUPLAT Date: Sat, 24 Aug 2019 15:11:13 +0200 Subject: [PATCH 1/2] Add regression test for utf-8 changelog support in rfstemplate --- debexpo/tests/importer/plugins/test_rfstemplate.py | 11 +++++++++++ .../sources/hello-utf8-changelog/debian/changelog | 6 ++++++ .../sources/hello-utf8-changelog/debian/compat | 1 + .../sources/hello-utf8-changelog/debian/control | 1 + .../sources/hello-utf8-changelog/debian/copyright | 1 + .../sources/hello-utf8-changelog/debian/rules | 1 + .../sources/hello-utf8-changelog/debian/source | 1 + 7 files changed, 22 insertions(+) create mode 100644 debexpo/tests/importer/sources/hello-utf8-changelog/debian/changelog create mode 120000 debexpo/tests/importer/sources/hello-utf8-changelog/debian/compat create mode 120000 debexpo/tests/importer/sources/hello-utf8-changelog/debian/control create mode 120000 debexpo/tests/importer/sources/hello-utf8-changelog/debian/copyright create mode 120000 debexpo/tests/importer/sources/hello-utf8-changelog/debian/rules create mode 120000 debexpo/tests/importer/sources/hello-utf8-changelog/debian/source diff --git a/debexpo/tests/importer/plugins/test_rfstemplate.py b/debexpo/tests/importer/plugins/test_rfstemplate.py index 7915d280..8249ca0c 100644 --- a/debexpo/tests/importer/plugins/test_rfstemplate.py +++ b/debexpo/tests/importer/plugins/test_rfstemplate.py @@ -40,6 +40,17 @@ class TestPluginRFSTemplate(TestImporterController): def __init__(self, *args, **kwargs): TestImporterController.__init__(self, *args, **kwargs) + def test_utf8_changelog(self): + self.import_source_package('hello-utf8-changelog') + self.assert_importer_succeeded() + self.assert_package_severity('hello', 'rfstemplate', + PLUGIN_SEVERITY_INFO) + self.assert_rfs_content('hello', + 'Subject: RFS: hello/1.0-1 -- Test package for ' + 'debexpo') + self.assert_rfs_content('hello', + 'Severity: normal') + def test_dep5_license(self): self.import_source_package('hello') self.assert_importer_succeeded() diff --git a/debexpo/tests/importer/sources/hello-utf8-changelog/debian/changelog b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/changelog new file mode 100644 index 00000000..3552cc78 --- /dev/null +++ b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/changelog @@ -0,0 +1,6 @@ +hello (1.0-1) unstable; urgency=medium + + * This is an UTF-8 changelog entry: é,ü,Й + * Initial release (Closes: #0) + + -- Vincent TIME Sun, 02 Dec 2018 22:38:11 +0100 diff --git a/debexpo/tests/importer/sources/hello-utf8-changelog/debian/compat b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/compat new file mode 120000 index 00000000..ea4b992c --- /dev/null +++ b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/compat @@ -0,0 +1 @@ +../../hello/debian/compat \ No newline at end of file diff --git a/debexpo/tests/importer/sources/hello-utf8-changelog/debian/control b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/control new file mode 120000 index 00000000..ab5561cd --- /dev/null +++ b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/control @@ -0,0 +1 @@ +../../hello/debian/control \ No newline at end of file diff --git a/debexpo/tests/importer/sources/hello-utf8-changelog/debian/copyright b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/copyright new file mode 120000 index 00000000..70d117c0 --- /dev/null +++ b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/copyright @@ -0,0 +1 @@ +../../hello/debian/copyright \ No newline at end of file diff --git a/debexpo/tests/importer/sources/hello-utf8-changelog/debian/rules b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/rules new file mode 120000 index 00000000..05451293 --- /dev/null +++ b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/rules @@ -0,0 +1 @@ +../../hello/debian/rules \ No newline at end of file diff --git a/debexpo/tests/importer/sources/hello-utf8-changelog/debian/source b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/source new file mode 120000 index 00000000..0f8a69b5 --- /dev/null +++ b/debexpo/tests/importer/sources/hello-utf8-changelog/debian/source @@ -0,0 +1 @@ +../../hello/debian/source \ No newline at end of file -- GitLab From c372e3dec1c57cd6f5398624f9211eddbf4e17bd Mon Sep 17 00:00:00 2001 From: Baptiste BEAUPLAT Date: Sat, 24 Aug 2019 15:11:51 +0200 Subject: [PATCH 2/2] Fix utf-8 changelog support in RFS template --- debexpo/controllers/sponsor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debexpo/controllers/sponsor.py b/debexpo/controllers/sponsor.py index 88fff629..cffae857 100644 --- a/debexpo/controllers/sponsor.py +++ b/debexpo/controllers/sponsor.py @@ -327,7 +327,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).replace('+', '%20') + c.mailbody = urllib.quote_plus(c.mailbody.encode('utf-8')) \ + .replace('+', '%20') return render('/sponsor/rfs_howto.mako') -- GitLab