~sircmpwn/aerc

pgp: recognize uppercase MIME signatures v1 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/10727/mbox | git am -3
Learn more about email & git

[PATCH] 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
> +          subtype := strings.ToLower(info.MIMESubType)
This line uses spaces for indentation, but Go programs should use tabs.
Please run `go fmt ./...` before sending a patch next time :)
View this thread in the archives