summaryrefslogtreecommitdiff
path: root/alot/db/attachment.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-07-22 16:42:24 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-07-22 19:32:53 +0100
commit3a9db2e595eb6f00ef575bbf9c5ddf73466ade16 (patch)
tree5e94542d156ddcc6ce67d86122f72074eaac6658 /alot/db/attachment.py
parent3f4d68391f9e1fb45f1dea3b6dd994322a178493 (diff)
fix maxlength issue
this uses a email.header.Header obj for attachments-parts Content-Disposition header to ensure their filename-parameters obey RFC2184
Diffstat (limited to 'alot/db/attachment.py')
-rw-r--r--alot/db/attachment.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/alot/db/attachment.py b/alot/db/attachment.py
index 2083dedd..2f8b37dc 100644
--- a/alot/db/attachment.py
+++ b/alot/db/attachment.py
@@ -4,6 +4,8 @@
import os
import tempfile
import email.charset as charset
+from email.header import Header
+from copy import deepcopy
charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
import alot.helper as helper
from alot.helper import string_decode
@@ -81,4 +83,9 @@ class Attachment(object):
def get_mime_representation(self):
"""returns mime part that constitutes this attachment"""
- return self.part
+ part = deepcopy(self.part)
+ cd = self.part['Content-Disposition']
+ del part['Content-Disposition']
+ part['Content-Disposition'] = Header(cd, maxlinelen=78,
+ header_name='Content-Disposition')
+ return part