~sircmpwn/aerc

pgp: recognize uppercase MIME signatures v2 PROPOSED

impaqt
impaqt: 1
 pgp: recognize uppercase MIME signatures

 1 files changed, 4 insertions(+), 4 deletions(-)
impaqt
Ah, sorry. I see the issue. I've never written any Go before so I had
no tooling set up. I ran go fmt manually but forgot to git add the file
before amending my commit. I'm not being stubborn, just stupid; I
totally get the importance of automatic, agreed-upon formatting!

I removed my comments from the commit, but I don't really see what's
wrong with putting comments in the commit description in general. If
written in the email's comments and not the commit/patch itself, the
questions don't make it into the commit log, and are less likely to
be stumbled upon in the future. I see there are several other commits
in the log that pose questions about further refactoring, like 92f59ef.
At the very least, the rationale for the change (in this case, the fact
that emails are arriving with uppercase MIME signatures) should be
documented in the commit description, no?
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/10744/mbox | git am -3
Learn more about email & git

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

impaqt
I got an email the other day with an "APPLICATION/PGP-SIGNATURE"
attachment that wasn't recognized because it wasn't a lowercase
"application/pgp-signature". Perhaps MIME types should be lowercased
globally upon parsing?
---
 lib/messageview.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/messageview.go b/lib/messageview.go
index 59a1af6..db0184b 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
View this thread in the archives