Skip to content

Commit

Permalink
db/attachment: use set_param() instead of recreating a header
Browse files Browse the repository at this point in the history
This is more elegant and efficient way to handle this.
  • Loading branch information
dcbaker authored and pazz committed Aug 4, 2018
1 parent 1240eba commit 5c53edf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions alot/db/attachment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# Copyright © 2018 Dylan Baker
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import os
import tempfile
import email.charset as charset
from email.header import Header
from copy import deepcopy

from ..helper import string_decode, humanize_size, guess_mimetype
Expand Down Expand Up @@ -86,8 +86,5 @@ def get_data(self):
def get_mime_representation(self):
"""returns mime part that constitutes this attachment"""
part = deepcopy(self.part)
part['Content-Disposition'] = Header(
self.part['Content-Disposition'],
maxlinelen=78,
header_name='Content-Disposition').encode()
part.set_param('maxlinelen', '78', header='Content-Disposition')
return part

0 comments on commit 5c53edf

Please sign in to comment.