mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 19:08:09 +01:00
devel/nmweb: read mail files in binary mode.
"ju" reported on IRC that browsing https://nmbug.notmuchmail.org/nmweb/show/20160719094205.qmf5sjnja6crt5t3%40gotlib crashed. The underlying issue is that python3 defaults to utf8 decoding files unless they are opened in binary mode. The file in question (in the nmbug archive; it depends a bit on the routing the message took) has Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit and some of it is not valid utf8.
This commit is contained in:
parent
32bef33565
commit
12aa05f07c
1 changed files with 1 additions and 1 deletions
|
@ -207,7 +207,7 @@ env.globals['thread_nav'] = thread_nav
|
||||||
|
|
||||||
def format_message(nm_msg, mid):
|
def format_message(nm_msg, mid):
|
||||||
fn = list(nm_msg.filenames())[0]
|
fn = list(nm_msg.filenames())[0]
|
||||||
msg = MaildirMessage(open(fn))
|
msg = MaildirMessage(open(fn, 'rb'))
|
||||||
return format_message_walk(msg, mid)
|
return format_message_walk(msg, mid)
|
||||||
|
|
||||||
def decodeAnyway(txt, charset='ascii'):
|
def decodeAnyway(txt, charset='ascii'):
|
||||||
|
|
Loading…
Reference in a new issue