* mu-cmd-server.c: fix bogus error when saving attachments

This commit is contained in:
djcb
2011-12-22 21:20:35 +02:00
parent c9d9db488e
commit 54bbe4dcf9

View File

@ -592,7 +592,7 @@ save_part (MuMsg *msg, const char* targetpath, unsigned partindex, GError **err)
} }
static gboolean static MuError
open_part (MuMsg *msg, unsigned partindex, GError **err) open_part (MuMsg *msg, unsigned partindex, GError **err)
{ {
char *targetpath; char *targetpath;
@ -603,18 +603,17 @@ open_part (MuMsg *msg, unsigned partindex, GError **err)
rv = mu_msg_part_save (msg, targetpath, partindex, rv = mu_msg_part_save (msg, targetpath, partindex,
FALSE/*overwrite*/, TRUE/*use cache*/, err); FALSE/*overwrite*/, TRUE/*use cache*/, err);
if (!rv) { if (!rv) {
g_set_error (err, 0, MU_ERROR_FILE,
"failed to save to '%s'", targetpath);
g_free (targetpath); g_free (targetpath);
return FALSE; return server_error (err, MU_ERROR_FILE,
"failed to save");
} }
rv = mu_util_play (targetpath, TRUE/*allow local*/, rv = mu_util_play (targetpath, TRUE/*allow local*/,
FALSE/*allow remote*/); FALSE/*allow remote*/);
if (!rv) if (!rv) {
g_set_error (err, 0, MU_ERROR_FILE, g_free (targetpath);
"failed to open '%s'", targetpath); return server_error (err, MU_ERROR_FILE, "failed to open");
else { } else {
gchar *path; gchar *path;
path = mu_str_escape_c_literal (targetpath, FALSE); path = mu_str_escape_c_literal (targetpath, FALSE);
send_expr ("(:info open :message \"%s has been opened\")", send_expr ("(:info open :message \"%s has been opened\")",
@ -624,7 +623,7 @@ open_part (MuMsg *msg, unsigned partindex, GError **err)
g_free (targetpath); g_free (targetpath);
return rv; return MU_OK;
} }
@ -656,11 +655,7 @@ save_or_open (MuStore *store, GSList *args, gboolean is_save, GError **err)
mu_msg_unref (msg); mu_msg_unref (msg);
if (!rv) return rv;
return server_error (err, MU_ERROR_FILE,
"failed to save to target path");
return MU_OK;
} }