From 18b0c6d8f71972be8bbe7e7ce08176c91a912080 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Thu, 16 Jun 2016 17:40:53 -0300 Subject: Fix UNNAMED attachment bug Previously some attachments were being showed as UNNAMED. This change fix it and creates propers tests for attachments. See: #608 --- service/pixelated/adapter/mailstore/leap_mailstore.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'service/pixelated/adapter/mailstore/leap_mailstore.py') diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index 70b53c37..97c95a90 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -166,7 +166,7 @@ class LeapMail(Mail): def _extract_filename(headers, default_filename='UNNAMED'): - content_disposition = headers.get('Content-Disposition', '') + content_disposition = headers.get('Content-Disposition') or headers.get('content-disposition', '') filename = _extract_filename_from_name_header_part(content_disposition) if not filename: filename = headers.get('Content-Description', '') @@ -363,7 +363,7 @@ class LeapMailStore(MailStore): return self._extract_part_map(part_maps) def _is_attachment(self, part_map, headers): - disposition = headers.get('Content-Disposition', None) + disposition = headers.get('Content-Disposition') or headers.get('content-disposition') content_type = part_map['ctype'] if 'multipart' in content_type: -- cgit v1.2.3