Remove double-quotes around attachment filename

This commit is contained in:
Stéphane Blondon
2017-10-13 16:02:57 +02:00
parent ea4fd7d9ea
commit 7c6cc2fb5f
2 changed files with 2 additions and 2 deletions

View File

@@ -105,7 +105,7 @@ def parse_attachment(message_part):
name, value = decode_param(param)
if 'file' in name:
attachment['filename'] = value
attachment['filename'] = value[1:-1] if value.startswith('"') else value
if 'create-date' in name:
attachment['create-date'] = value

View File

@@ -321,7 +321,7 @@ class TestParser(unittest.TestCase):
attachment = parsed_email.attachments[0]
self.assertEqual('application/octet-stream', attachment['content-type'])
self.assertEqual(71, attachment['size'])
self.assertEqual('"abc.xyz"', attachment['filename'])
self.assertEqual('abc.xyz', attachment['filename'])
self.assertTrue(attachment['content'])
# TODO - Complete the test suite