~sircmpwn/aerc

pgp: recognize uppercase MIME signatures v3 PROPOSED

impaqt
impaqt: 1
 pgp: recognize uppercase MIME signatures

 1 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/10748/mbox | git am -3
Learn more about email & git

[PATCH v3] pgp: recognize uppercase MIME signatures Export this patch

impaqt
Some emails are sent with an "APPLICATION/PGP-SIGNATURE" instead
of an "application/pgp-signature". Both should be recognized.
---
 Third time's the charm.
 
 lib/messageview.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/messageview.go b/lib/messageview.go
index 59a1af6..bd88aaa 100644
--- a/lib/messageview.go
+++ b/lib/messageview.go
@@ -4,6 +4,7 @@ import (
	"bytes"
	"io"
	"io/ioutil"
	"strings"

	"github.com/emersion/go-message"
	_ "github.com/emersion/go-message/charset"
@@ -34,10 +35,9 @@ type MessageView interface {
}

func usePGP(info *models.BodyStructure) bool {
	if info.MIMEType == "application" {
		if info.MIMESubType == "pgp-encrypted" ||
			info.MIMESubType == "pgp-signature" {

	if strings.ToLower(info.MIMEType) == "application" {
		subtype := strings.ToLower(info.MIMESubType)
		if subtype == "pgp-encrypted" || subtype == "pgp-signature" {
			return true
		}
	}
-- 
2.26.2
Re lower-casing MIME types by default: I've considered doing this by
default in the go-imap library and chose not to to stay unopinionated.
However in insight that's probably a mistake and causes too much pain.
The stdlib's mime package also lowers the MIME type when parsing and
formatting it.

I'd merge a patch lower-casing the MIME type in go-imap.
I agree that this can be solved in emersion's library instead of in
aerc.
View this thread in the archives