From 91a989d7f47588a1dbea28889484c2850e7f8fa8 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Thu, 28 Feb 2008 14:57:09 +0000 Subject: [PATCH] * src/modest-tny-mime-part.c (modest_tny_mime_part_is_attachment_for_modest): Consider alternate formats for the "name" parameter in the Content-Disposition header, so files with inline disposition and encoded as detailed in RFC2231 appear as attachments in Modest Partially fixes NB#81300 pmo-trunk-r4247 --- src/modest-tny-mime-part.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/modest-tny-mime-part.c b/src/modest-tny-mime-part.c index 993664d..67cde71 100644 --- a/src/modest-tny-mime-part.c +++ b/src/modest-tny-mime-part.c @@ -94,9 +94,22 @@ modest_tny_mime_part_is_attachment_for_modest (TnyMimePart *part) tmp = modest_tny_mime_part_get_header_value (part, "Content-Disposition"); if (tmp) { + /* If the Content-Disposition header contains a "name" + * parameter, treat the mime part as an attachment */ gchar *content_disp = g_ascii_strdown(tmp, -1); + gint len = strlen (content_disp); + const gchar *substr = g_strstr_len (content_disp, len, "name"); + if (substr != NULL) { + gint substrlen = len - (substr - content_disp); + /* The parameter can appear in muliple + * ways. See RFC 2231 for details */ + has_content_disp_name = + g_strstr_len (substr, substrlen, "name=") != NULL || + g_strstr_len (substr, substrlen, "name*=") != NULL || + g_strstr_len (substr, substrlen, "name*0=") != NULL || + g_strstr_len (substr, substrlen, "name*0*=") != NULL; + } g_free (tmp); - has_content_disp_name = g_strstr_len (content_disp, strlen(content_disp), "name=") != NULL; g_free (content_disp); } -- 1.7.9.5