X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-mime-part.c;h=ff6c1cdf90909adbca32e7e6f6a1a572463e29df;hp=e438f347e3f1bda9eb386346b3c6a8ea37b80feb;hb=b51a8d716cce846c1c6086aaffbebb4ebd36a256;hpb=d2ea95049c43f1fc3089109866757e45139d0d9a diff --git a/src/modest-tny-mime-part.c b/src/modest-tny-mime-part.c index e438f34..ff6c1cd 100644 --- a/src/modest-tny-mime-part.c +++ b/src/modest-tny-mime-part.c @@ -211,21 +211,24 @@ gchar * modest_tny_mime_part_get_headers_content_type (TnyMimePart *part) { gchar *header_content_type; - gchar *header_content_type_lower; gchar *suffix; g_return_val_if_fail (TNY_IS_MIME_PART (part), NULL); header_content_type = modest_tny_mime_part_get_header_value (part, "Content-Type"); + + /* See RFC2045 sec 5.2 */ + if (!header_content_type) + return g_strdup ("text/plain; charset=us-ascii"); + header_content_type = g_strstrip (header_content_type); /* remove the ; suffix */ suffix = index (header_content_type, ';'); - suffix[0] = '\0'; + if (suffix) + suffix[0] = '\0'; - header_content_type_lower = (header_content_type ) ? - g_ascii_strdown (header_content_type, -1) : NULL; - return header_content_type_lower; + return g_ascii_strdown (header_content_type, -1); } gchar *