summaryrefslogtreecommitdiff
path: root/libdocument/ev-attachment.c
diff options
context:
space:
mode:
authorJustin Willmert <[email protected]>2012-07-04 11:34:12 +0200
committerStefano Karapetsas <[email protected]>2015-04-04 19:24:27 +0200
commiteb1349a339e9c66d4149d4ed62db36729f09cbb4 (patch)
tree0bb6485dd3736c8b7bdc2892609c6d2994769bc0 /libdocument/ev-attachment.c
parentc819a6050cd3800176fb26e4a20919d135b56902 (diff)
downloadatril-eb1349a339e9c66d4149d4ed62db36729f09cbb4.tar.bz2
atril-eb1349a339e9c66d4149d4ed62db36729f09cbb4.tar.xz
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 (cherry picked from commit ff8a330756f in Evince) Closes https://github.com/mate-desktop/atril/pull/131
Diffstat (limited to 'libdocument/ev-attachment.c')
-rw-r--r--libdocument/ev-attachment.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c
index 26047819..6e7942ee 100644
--- a/libdocument/ev-attachment.c
+++ b/libdocument/ev-attachment.c
@@ -414,13 +414,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)