Skip to content

Commit fe8b1cb

Browse files
committed
Use as_bytes() instead of as_string() to generate mbox
We're supposed to feed django bytes, and by feeding it a string it got converted bytes->string by the mail end and then string->bytes by django. Which promptly blew up on bad encodings. By keeping it as bytes all the way, the problem is ignored.
1 parent f9720d7 commit fe8b1cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

django/archives/mailarchives/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def _one_message(raw):
587587
s = BytesIO(raw)
588588
parser = email.parser.BytesParser(policy=email.policy.compat32)
589589
msg = parser.parse(s)
590-
return msg.as_string(unixfrom=True)
590+
return msg.as_bytes(unixfrom=True)
591591

592592
def _message_stream(first):
593593
yield _one_message(first[1])

0 commit comments

Comments
 (0)