aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-28 06:11:44 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-28 06:12:45 +0800
commitff2c9f849966118d23de068527f3f769b5339f00 (patch)
tree93214f04ee77ca3cdb6bfc9e34602371eb305472 /em-format
parentcef69607d59c2add63104504e6a5ecad2de51373 (diff)
downloadgsoc2013-evolution-ff2c9f849966118d23de068527f3f769b5339f00.tar.gz
gsoc2013-evolution-ff2c9f849966118d23de068527f3f769b5339f00.tar.zst
gsoc2013-evolution-ff2c9f849966118d23de068527f3f769b5339f00.zip
Bug 628154 - Ignore paths in MIME part filenames
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/em-format/em-format.c b/em-format/em-format.c
index f07d6e3c5a..b82420ae7a 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1428,12 +1428,19 @@ em_format_describe_part (CamelMimePart *part,
g_free (content_type);
g_string_append_printf (stext, _("%s attachment"), desc ? desc : mime_type);
g_free (desc);
- if ((filename = camel_mime_part_get_filename (part)))
- g_string_append_printf(stext, " (%s)", filename);
- if ((description = camel_mime_part_get_description(part)) &&
- (*description != 0) &&
- !(filename && (strcmp(filename, description) == 0)))
- g_string_append_printf(stext, ", \"%s\"", description);
+
+ filename = camel_mime_part_get_filename (part);
+ description = camel_mime_part_get_description (part);
+
+ if (filename != NULL && *filename != '\0') {
+ gchar *basename = g_path_get_basename (filename);
+ g_string_append_printf (stext, " (%s)", basename);
+ g_free (basename);
+ }
+
+ if (description != NULL && *description != '\0' &&
+ g_strcmp0 (filename, description) != 0)
+ g_string_append_printf (stext, ", \"%s\"", description);
return g_string_free (stext, FALSE);
}