#3804 Fix the From header in notification emails
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+1 -1
@@ -310,7 +310,7 @@ 

          from_email = from_email.decode("utf-8")

      if user_from:

          header = Header(user_from, "utf-8")

-         from_email = "%s <%s>" % (header, from_email)

+         from_email = "%s <%s>" % (header.encode(), from_email)

  

      if project_name is not None:

          subject_tag = project_name

@@ -424,7 +424,9 @@ 

          # Due to differences in the way Python2 and Python3 encode non-ascii

          # email headers, we compare the From and To headers separately from the

          # rest of the message.

-         self.assertEqual(email["From"], "Zöé <pagure@localhost.localdomain>")

+         self.assertEqual(

+             email["From"],

+             "=?utf-8?b?WsO2w6k=?= <pagure@localhost.localdomain>")

          self.assertEqual(email["To"], "zöé@foo.net")

          del email["From"]

          del email["To"]
@@ -456,7 +458,9 @@ 

              project_name='namespace/project',

              user_from='Zöé',

          )

-         self.assertEqual(email["From"], "Zöé <pagure@localhost.localdomain>")

+         self.assertEqual(

+             email["From"],

+             "=?utf-8?b?WsO2w6k=?= <pagure@localhost.localdomain>")

          self.assertEqual(email["To"], "zöé@foo.net")

          del email["From"]

          del email["To"]
@@ -508,7 +512,9 @@ 

          # Due to differences in the way Python2 and Python3 encode non-ascii

          # email headers, we compare the From and To headers separately from the

          # rest of the message.

-         self.assertEqual(email["From"], "Zöé <pagure@localhost.localdomain>")

+         self.assertEqual(

+             email["From"],

+             "=?utf-8?b?WsO2w6k=?= <pagure@localhost.localdomain>")

          self.assertEqual(email["To"], "zöé@foo.net")

          del email["From"]

          del email["To"]