diff options
author | Milan Crha <mcrha@redhat.com> | 2013-02-20 18:32:46 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-02-20 18:32:46 +0800 |
commit | 80b93e39ac63a1adb76610e0f84c5273f675e603 (patch) | |
tree | b1ee263cc540418cc699692258856599c6f97950 | |
parent | 685e763c6ac8923cbf8af5c5c84d441ee2df7db5 (diff) | |
download | gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.tar gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.tar.gz gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.tar.bz2 gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.tar.lz gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.tar.xz gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.tar.zst gsoc2013-evolution-80b93e39ac63a1adb76610e0f84c5273f675e603.zip |
EAttachment: Decode part's file name before using it
-rw-r--r-- | e-util/e-attachment.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/e-util/e-attachment.c b/e-util/e-attachment.c index 22ad0be653..a460890246 100644 --- a/e-util/e-attachment.c +++ b/e-util/e-attachment.c @@ -1785,7 +1785,7 @@ attachment_load_from_mime_part_thread (GSimpleAsyncResult *simple, CamelMimePart *mime_part; const gchar *attribute; const gchar *string; - gchar *allocated; + gchar *allocated, *decoded_string = NULL; CamelStream *null; CamelDataWrapper *dw; @@ -1836,11 +1836,21 @@ attachment_load_from_mime_part_thread (GSimpleAsyncResult *simple, /* Strip any path components from the filename. */ string = camel_mime_part_get_filename (mime_part); - if (string == NULL) + if (string == NULL) { /* Translators: Default attachment filename. */ string = _("attachment.dat"); + } else { + decoded_string = camel_header_decode_string (string, "UTF-8"); + if (decoded_string && *decoded_string && !g_str_equal (decoded_string, string)) { + string = decoded_string; + } else { + g_free (decoded_string); + decoded_string = NULL; + } + } allocated = g_path_get_basename (string); g_file_info_set_display_name (file_info, allocated); + g_free (decoded_string); g_free (allocated); attribute = G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION; |