]> granicus.if.org Git - neomutt/commitdiff
Fix mailcap %{charset} expansion in send mode
authorKevin McCarthy <kevin@8t8.us>
Fri, 8 Mar 2019 10:06:52 +0000 (18:06 +0800)
committerRichard Russon <rich@flatcap.org>
Tue, 9 Apr 2019 11:54:27 +0000 (12:54 +0100)
Use the current charset of the file for the parameter, since the file
hasn't been converted yet.

Co-authored-by: Richard Russon <rich@flatcap.org>
rfc1524.c

index 428faa0d28e3aea3a5f0e5ab2247e18deb231e4e..0fd284951f52e2bd1ef8a24a26f23f3a8d751ac3 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -104,7 +104,12 @@ int rfc1524_expand_command(struct Body *a, const char *filename,
           param[z++] = command[x++];
         param[z] = '\0';
 
-        pvalue2 = mutt_param_get(&a->parameter, param);
+        /* In send mode, use the current charset, since the message hasn't
+         * been converted yet. */
+        if ((mutt_str_strcasecmp(param, "charset") == 0) && a->charset)
+          pvalue2 = a->charset;
+        else
+          pvalue2 = mutt_param_get(&a->parameter, param);
         mutt_str_strfcpy(pvalue, pvalue2, sizeof(pvalue));
         if (C_MailcapSanitize)
           mutt_file_sanitize_filename(pvalue, false);