From c41e1b6a15f6c6b9dec7a4c0efc22f234bf6bb76 Mon Sep 17 00:00:00 2001 From: Thorsten Maerz Date: Sat, 22 Feb 2003 11:47:14 +0000 Subject: [PATCH] save-all fixes --- ChangeLog.claws | 6 ++++++ configure.ac | 2 +- src/mimeview.c | 13 +++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index d699dc86b..ef1202d60 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,9 @@ +2003-02-22 [thorsten] 0.8.10claws41 + + * src/mimeview.c + save-all fixes: crash if invoked on multipart container, + mimeinfo access, pathseparators, error dialog + 2003-02-21 [alfons] 0.8.10claws40 * src/prefs_gtk.c diff --git a/configure.ac b/configure.ac index 60674b745..720ff2ccb 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=10 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws40 +EXTRA_VERSION=claws41 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/mimeview.c b/src/mimeview.c index 8bf07a945..fd37a5202 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -810,24 +810,25 @@ static void mimeview_save_all(MimeView *mimeview) if (!dirname) return; /* return to first children */ + if (!partinfo->parent->children) return; /* multipart container? */ attachment = partinfo->parent->children->next; /* for each attachment, extract it in the selected dir. */ while (attachment != NULL) { static guint subst_cnt = 1; gchar *attachdir; - gchar *attachname = (attachment->filename) - ? g_strdup(attachment->filename) - : g_strdup_printf("noname.%d",subst_cnt++); - AlertValue aval; + gchar *attachname = g_strdup(get_part_name(attachment)); + AlertValue aval = G_ALERTDEFAULT; gchar *res; - subst_chars(attachname, "/\\", G_DIR_SEPARATOR); + if (!attachname || !strlen(attachname)) + attachname = g_strdup_printf("noname.%d",subst_cnt++); subst_chars(attachname, ":?*&|<>\t\r\n", '_'); g_snprintf(buf, sizeof(buf), "%s%s", dirname, (attachname[0] == G_DIR_SEPARATOR) ? &attachname[1] : attachname); + subst_chars(buf, "/\\", G_DIR_SEPARATOR); attachdir = g_dirname(buf); make_dir_hier(attachdir); g_free(attachdir); @@ -841,7 +842,7 @@ static void mimeview_save_all(MimeView *mimeview) } g_free(attachname); - if (G_ALERTDEFAULT == aval && procmime_get_part(buf, mimeview->file, attachment) < 0) + if ((G_ALERTDEFAULT != aval) || (procmime_get_part(buf, mimeview->file, attachment) < 0)) alertpanel_error(_("Can't save the part of multipart message.")); attachment = attachment->next; } -- 2.25.1