From 2d7d3c489d28098271222e9b800c67c0fee078d2 Mon Sep 17 00:00:00 2001 From: Ross Poulton Date: Sat, 29 Jan 2011 06:25:53 +0000 Subject: [PATCH] Correct handling of e-mail attachments where the name is encoded in rfc2231. Thanks to Sergey Kirillov for the patch, which closes Google Code issue #154 and Github issue #11. --- helpdesk/management/commands/get_email.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helpdesk/management/commands/get_email.py b/helpdesk/management/commands/get_email.py index d1f6553e..05fd34ce 100644 --- a/helpdesk/management/commands/get_email.py +++ b/helpdesk/management/commands/get_email.py @@ -18,7 +18,7 @@ import re from datetime import datetime, timedelta from email.header import decode_header -from email.Utils import parseaddr +from email.Utils import parseaddr, collapse_rfc2231_value from optparse import make_option from django.core.files.base import ContentFile @@ -177,6 +177,8 @@ def ticket_from_message(message, queue, quiet): continue name = part.get_param("name") + if name: + name = collapse_rfc2231_value(name) if part.get_content_maintype() == 'text' and name == None: if part.get_content_subtype() == 'plain':