[evolution] Bug 628154 - Ignore paths in MIME part filenames
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 628154 - Ignore paths in MIME part filenames
- Date: Fri, 27 Aug 2010 22:12:55 +0000 (UTC)
commit ff2c9f849966118d23de068527f3f769b5339f00
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Aug 27 18:11:44 2010 -0400
Bug 628154 - Ignore paths in MIME part filenames
em-format/em-format.c | 19 +++++++++++++------
widgets/misc/e-attachment.c | 5 ++++-
2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index f07d6e3..b82420a 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);
}
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index e8ba75a..468e164 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1778,11 +1778,14 @@ attachment_load_from_mime_part (LoadContext *load_context)
}
g_free (allocated);
+ /* Strip any path components from the filename. */
string = camel_mime_part_get_filename (mime_part);
if (string == NULL)
/* Translators: Default attachment filename. */
string = _("attachment.dat");
- g_file_info_set_display_name (file_info, string);
+ allocated = g_path_get_basename (string);
+ g_file_info_set_display_name (file_info, allocated);
+ g_free (allocated);
attribute = G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION;
string = camel_mime_part_get_description (mime_part);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]