diff options
author | Milan Crha <mcrha@redhat.com> | 2017-11-29 14:25:16 +0100 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2017-11-29 14:28:54 +0100 |
commit | 0409f178e1fcd57f76fe8f1446e56e8aba9baab9 (patch) | |
tree | f2eada6f9fc471a3d823d8384895643dd03054ba | |
parent | 0afe823b860114b35719232a68f6b16ac0cfe2c4 (diff) | |
download | evolution-0409f178e1fcd57f76fe8f1446e56e8aba9baab9.tar.gz |
Bug 790944 - Attachment filename in multipart/mixed can be lost
-rw-r--r-- | src/em-format/e-mail-parser-multipart-mixed.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/em-format/e-mail-parser-multipart-mixed.c b/src/em-format/e-mail-parser-multipart-mixed.c index 6d3aefea17..4b47d91355 100644 --- a/src/em-format/e-mail-parser-multipart-mixed.c +++ b/src/em-format/e-mail-parser-multipart-mixed.c @@ -172,8 +172,24 @@ empe_mp_mixed_parse (EMailParserExtension *extension, dw = camel_data_wrapper_new (); camel_data_wrapper_set_mime_type (dw, snoop_type); if (camel_data_wrapper_construct_from_stream_sync (dw, mem_stream, cancellable, NULL)) { + const gchar *disposition; + camel_medium_set_content (CAMEL_MEDIUM (opart), dw); - camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (opart), snoop_type); + + /* Copy Content-Disposition header, if available */ + disposition = camel_medium_get_header (CAMEL_MEDIUM (subpart), "Content-Disposition"); + if (disposition) + camel_medium_set_header (CAMEL_MEDIUM (opart), "Content-Disposition", disposition); + + /* Copy also any existing parameters of the Content-Type, like 'name' or 'charset'. */ + if (ct && ct->params) { + CamelHeaderParam *param; + for (param = ct->params; param; param = param->next) { + camel_content_type_set_param (snoop_ct, param->name, param->value); + } + } + + camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (opart), snoop_ct); handled = e_mail_parser_parse_part (parser, opart, part_id, cancellable, &work_queue); if (handled) { |