[sysadmin-bin] If the e-mail subject is unicode already (which is the case with Gitlab), don't try decoding it furt



commit a22afb9960f908efe8e66c092401e7295625cb17
Author: Andrea Veri <averi redhat com>
Date:   Mon Dec 18 12:58:50 2017 +0100

    If the e-mail subject is unicode already (which is the case with Gitlab), don't try decoding it further

 git/gnome-post-receive-email | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/git/gnome-post-receive-email b/git/gnome-post-receive-email
index 0b5944f..b3ad49b 100755
--- a/git/gnome-post-receive-email
+++ b/git/gnome-post-receive-email
@@ -155,6 +155,11 @@ class RefChange(object):
         if cc is None:
             cc = self.cc
 
+        if isinstance(subject, unicode):
+            subject = Header.Header(subject)
+        else:
+            subject = Header.Header(subject.decode('utf-8'))
+
         print >>out, s("""
 To: %(recipients)s
 Cc: %(cc)s
@@ -169,7 +174,7 @@ Content-Transfer-Encoding: 8bit
             'recipients': recipients,
             'cc': ','.join(cc),
             'from_address': from_address,
-            'subject': Header.Header(subject.decode('utf-8')),
+            'subject': subject
             'projectshort': projectshort,
             'refname': self.refname
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]