c65c12bec326180f326c6aa4762c8b5e079cc961 — Kevin McCarthy 4 months ago 472324f
Fix mutt_write_mime_body() application/pgp-encrypted handling.

It would blindly overwrite any attachment with that type, as if it
were the version label part of a multipart/encrypted message.

However attachments with extenstion .gpg are labeled that type if
$mime_type_query_command is set to "xdg-mime query filetype".  This
would cause the attachment to be overwritten too.

Add a check for a missing body->filename, which should only be the
case for the manually constructed part.
1 files changed, 2 insertions(+), 1 deletions(-)

M sendlib.c
M sendlib.c => sendlib.c +2 -1
@@ 461,7 461,8 @@ int mutt_write_mime_body (BODY *a, FILE *f)
   /* This is pretty gross, but it's the best solution for now... */
   if ((WithCrypto & APPLICATION_PGP)
       && a->type == TYPEAPPLICATION
-      && mutt_strcmp (a->subtype, "pgp-encrypted") == 0)
+      && mutt_strcmp (a->subtype, "pgp-encrypted") == 0
+      && !a->filename)
     fputs ("Version: 1\n", f);
     return 0;