]> granicus.if.org Git - mutt/commitdiff
Fix mailcap %{charset} expansion in send mode.
authorKevin McCarthy <kevin@8t8.us>
Fri, 8 Mar 2019 10:06:52 +0000 (18:06 +0800)
committerKevin McCarthy <kevin@8t8.us>
Fri, 8 Mar 2019 10:06:52 +0000 (18:06 +0800)
Use the current charset of the file for the parameter, since the file
hasn't been converted yet.

rfc1524.c

index 534fda7b0d8dfa8dcae2764806dd5644e0dbfabb..2a9e3afd72a9f3d21d0f5df713f022dfd0875b44 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -102,7 +102,12 @@ int rfc1524_expand_command (BODY *a, const char *filename, const char *_type,
          param[z++] = command[x++];
        param[z] = '\0';
 
-       _pvalue = mutt_get_parameter (param, a->parameter);
+        /* In send mode, use the current charset, since the message hasn't
+         * been converted yet. */
+        if ((ascii_strcasecmp (param, "charset") == 0) && a->charset)
+          _pvalue = a->charset;
+        else
+          _pvalue = mutt_get_parameter (param, a->parameter);
        strfcpy (pvalue, NONULL(_pvalue), sizeof (pvalue));
        if (option (OPTMAILCAPSANITIZE))
          mutt_sanitize_filename (pvalue, 0);