[evince] libdocument: Fix saving attachments when the name contains a path
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] libdocument: Fix saving attachments when the name contains a path
- Date: Wed, 4 Jul 2012 09:36:02 +0000 (UTC)
commit ff8a330756fbb1704fd28785bda6b0677ac8dd9e
Author: Justin Willmert <justin jdjlab com>
Date: Wed Jul 4 11:34:12 2012 +0200
libdocument: Fix saving attachments when the name contains a path
Use the basename for the temp file template instead of using the
attachment name directly.
https://bugzilla.gnome.org/show_bug.cgi?id=679354
libdocument/ev-attachment.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c
index d8b4ba9..dc0d69a 100644
--- a/libdocument/ev-attachment.c
+++ b/libdocument/ev-attachment.c
@@ -421,13 +421,16 @@ ev_attachment_open (EvAttachment *attachment,
retval = ev_attachment_launch_app (attachment, screen,
timestamp, error);
} else {
+ char *basename;
char *template;
GFile *file;
/* FIXMEchpe: convert to filename encoding first! */
- template = g_strdup_printf ("%s.XXXXXX", ev_attachment_get_name (attachment));
+ basename = g_path_get_basename (ev_attachment_get_name (attachment));
+ template = g_strdup_printf ("%s.XXXXXX", basename);
file = ev_mkstemp_file (template, error);
g_free (template);
+ g_free (basename);
if (file != NULL && ev_attachment_save (attachment, file, error)) {
if (attachment->priv->tmp_file)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]