Also, save in home directory if attach_save_dir is not set.
gchar *cmd = NULL;
gchar buf[1024];
const gchar *p;
gchar *cmd = NULL;
gchar buf[1024];
const gchar *p;
- gchar *filename = NULL;
+ gchar *filename = NULL, *filepath = NULL;
gchar *tmp_filename = NULL;
if (uri == NULL)
gchar *tmp_filename = NULL;
if (uri == NULL)
subst_for_filename(filename);
subst_for_filename(filename);
+ filepath = g_strconcat(get_mime_tmp_dir(), G_DIR_SEPARATOR_S,
+ filename, NULL);
+
tmp_filename = g_filename_from_uri(uri->uri, NULL, NULL);
tmp_filename = g_filename_from_uri(uri->uri, NULL, NULL);
- copy_file(tmp_filename, filename, FALSE);
+ copy_file(tmp_filename, filepath, FALSE);
g_free(tmp_filename);
cmd = mailcap_get_command_for_type("image/jpeg", filename);
g_free(tmp_filename);
cmd = mailcap_get_command_for_type("image/jpeg", filename);
}
if (cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's' &&
!strchr(p + 2, '%'))
}
if (cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's' &&
!strchr(p + 2, '%'))
- g_snprintf(buf, sizeof(buf), cmd, filename);
+ g_snprintf(buf, sizeof(buf), cmd, filepath);
else {
g_warning("Image viewer command-line is invalid: '%s'", cmd);
else {
g_warning("Image viewer command-line is invalid: '%s'", cmd);
+ g_free(filepath);
+ g_free(filename);
return;
}
execute_command_line(buf, TRUE);
return;
}
execute_command_line(buf, TRUE);
g_free(filename);
g_free(cmd);
g_free(filename);
g_free(cmd);
filepath = g_strconcat(prefs_common.attach_save_dir,
G_DIR_SEPARATOR_S, filename, NULL);
else
filepath = g_strconcat(prefs_common.attach_save_dir,
G_DIR_SEPARATOR_S, filename, NULL);
else
- filepath = g_strdup(filename);
+ filepath = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
+ filename, NULL);