Skip to content

Commit

Permalink
Fix mbox exports. Fixes #3076.
Browse files Browse the repository at this point in the history
Sometime in August incoming message format changed.
Messages now include the "From " envelope header
when they didn't before. This resulted in duplicate
envelope headers in the export files, essentially
corrupting them. The export code was changed to only
add the envelope header if it isn't already there.

 - Legacy-Id: 1031
  • Loading branch information
rpcross committed Sep 17, 2020
1 parent 8112973 commit 61c5793
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions backend/mlarchive/archive/view_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,11 @@ def build_mbox_tar(sqs, tar, basename):
mbox_list = mlist

with open(result.object.get_file_path(), 'rb') as input:
# add envelope header
from_line = smart_bytes(result.object.get_from_line()) + b'\n'
mbox_file.write(from_line)
# add envelope header if missing
if not input.read(5) == b'From ':
from_line = smart_bytes(result.object.get_from_line()) + b'\n'
mbox_file.write(from_line)
input.seek(0)
mbox_file.write(input.read())
mbox_file.write(b'\n')

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- conf-mode -*-
# NOTE: Django 2.0, Celery 5.0 only support Python 3
setuptools>=18.5 # Require this first, to prevent later errors
#
#bs4 # 4.1.3 was installed
beautifulsoup4
Expand Down

0 comments on commit 61c5793

Please sign in to comment.