From: Kevin McCarthy Date: Tue, 10 Sep 2019 01:32:59 +0000 (-0700) Subject: Fix mutt_write_mime_body() application/pgp-encrypted handling X-Git-Tag: 2019-10-25~15^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a42082dde26edaa15f67593e38ebb0db83fe7392;p=neomutt 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. Co-authored-by: Richard Russon --- diff --git a/sendlib.c b/sendlib.c index 95b748a99..bf004b33f 100644 --- a/sendlib.c +++ b/sendlib.c @@ -550,8 +550,8 @@ int mutt_write_mime_body(struct Body *a, FILE *fp) } /* This is pretty gross, but it's the best solution for now... */ - if (((WithCrypto & APPLICATION_PGP) != 0) && (a->type == TYPE_APPLICATION) && - (mutt_str_strcmp(a->subtype, "pgp-encrypted") == 0)) + if ((WithCrypto & APPLICATION_PGP) && (a->type == TYPE_APPLICATION) && + (mutt_str_strcmp(a->subtype, "pgp-encrypted") == 0) && !a->filename) { fputs("Version: 1\n", fp); return 0;