From: Kevin McCarthy Date: Tue, 4 Oct 2016 18:13:24 +0000 (-0700) Subject: Preserve forwarded attachment names in d_filename. X-Git-Tag: neomutt-20170225~32^2~107^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfd95b516aaafb2540dc35fe14077af4ebc5bb99;p=neomutt Preserve forwarded attachment names in d_filename. When forwarding an attachment with an non-ascii name, mutt_copy_body() mangles the filename when calling mutt_adv_mktemp. Preserve the original attachment filename in d_filename. Remove the double copy of b->filename, which is a memory leak. --- diff --git a/muttlib.c b/muttlib.c index 209c7ab90..7439f44a7 100644 --- a/muttlib.c +++ b/muttlib.c @@ -132,8 +132,11 @@ int mutt_copy_body (FILE *fp, BODY **tgt, BODY *src) b->xtype = safe_strdup (b->xtype); b->subtype = safe_strdup (b->subtype); b->form_name = safe_strdup (b->form_name); - b->filename = safe_strdup (b->filename); b->d_filename = safe_strdup (b->d_filename); + /* mutt_adv_mktemp() will mangle the filename in tmp, + * so preserve it in d_filename */ + if (!b->d_filename && use_disp) + b->d_filename = safe_strdup (src->filename); b->description = safe_strdup (b->description); /*