From 01b9cbb9ce9f44387be22b5d036dde0fff4bb14b Mon Sep 17 00:00:00 2001 From: Veronika Kabatova Date: Thu, 5 Apr 2018 17:51:58 +0200 Subject: [PATCH] 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 --- patchwork/views/utils.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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) -- 2.47.3