From: Veronika Kabatova Date: Thu, 5 Apr 2018 15:51:58 +0000 (+0200) Subject: Include all email headers in mboxes X-Git-Tag: v2.1.0-rc1~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=01b9cbb9;p=thirdparty%2Fpatchwork.git Include all email headers in mboxes Solves issue #165 (Exported mboxes should include In-Reply-To, References, etc headers). Instead of including only a few chosen ones, all received headers are added to mboxes. Signed-off-by: Veronika Kabatova Reviewed-by: Stephen Finucane --- diff --git a/patchwork/views/utils.py b/patchwork/views/utils.py index 84682b8c..f5ff43c1 100644 --- a/patchwork/views/utils.py +++ b/patchwork/views/utils.py @@ -89,21 +89,17 @@ def _submission_to_mbox(submission): utc_timestamp = delta.seconds + delta.days * 24 * 3600 mail = PatchMbox(body) - mail['Subject'] = submission.name mail['X-Patchwork-Submitter'] = email.utils.formataddr(( str(Header(submission.submitter.name, mail.patch_charset)), submission.submitter.email)) mail['X-Patchwork-Id'] = str(submission.id) if is_patch and submission.delegate: mail['X-Patchwork-Delegate'] = str(submission.delegate.email) - mail['Message-Id'] = submission.msgid mail.set_unixfrom('From patchwork ' + submission.date.ctime()) - copied_headers = ['To', 'Cc', 'Date', 'From', 'List-Id'] orig_headers = HeaderParser().parsestr(str(submission.headers)) - for header in copied_headers: - if header in orig_headers: - mail[header] = orig_headers[header] + for key, val in orig_headers.items(): + mail[key] = val if 'Date' not in mail: mail['Date'] = email.utils.formatdate(utc_timestamp)