Cleanup of content-id attribute for email attachments (<> will be added by ruby mail gem automatically).

This commit is contained in:
Martin Edenhofer 2017-03-14 06:39:58 +01:00
parent 7977ea86a6
commit 6773970378
2 changed files with 11 additions and 0 deletions

View file

@ -356,6 +356,11 @@ class Channel::EmailParser
headers_store.delete('Content-Transfer-Encoding')
headers_store.delete('Content-Disposition')
# cleanup content id, <> will be added automatically later
if headers_store['Content-ID']
headers_store['Content-ID'].gsub!(/^</, '').gsub!(/>$/, '')
end
attach = {
data: file.body.to_s,
filename: filename,

View file

@ -302,6 +302,7 @@ Registergericht / Commercial Register of the Local Court: HRB 0000 AG Hof',
{
md5: 'ddbdf67aa2f5c60c294008a54d57082b',
filename: 'super-seven.jpg',
cid: '485376C9-2486-4351-B932-E2010998F579@home',
},
],
params: {
@ -328,6 +329,7 @@ Registergericht / Commercial Register of the Local Court: HRB 0000 AG Hof',
{
md5: 'a618d671348735744d4c9a4005b56799',
filename: 'image001.jpg',
cid: 'image001.jpg@01CDB132.D8A510F0',
},
],
params: {
@ -862,6 +864,7 @@ end
{
md5: 'de909e05b3dd8b8ea50e8db422d0971e',
filename: 'HKT_Super_Seven_GTS.jpeg',
cid: '2ECB31C9-0E1D-4EBF-BD02-8D8B24208A3E@openvpn',
},
{
md5: '72c2f9aecd24606b6490ff06ea9361ec',
@ -1038,6 +1041,9 @@ end
if attachment[:md5] == file_md5
found = true
assert_equal(attachment[:filename], attachment_parser[:filename])
if attachment[:cid]
assert_equal(attachment[:cid], attachment_parser[:preferences]['Content-ID'])
end
end
}
if !found