aboutsummaryrefslogtreecommitdiff
path: root/commands/msgview
diff options
context:
space:
mode:
authorRéouven Assouly <reouvenassouly@yahoo.fr>2019-06-15 12:28:03 +0200
committerDrew DeVault <sir@cmpwn.com>2019-06-16 11:24:42 -0400
commitdfe114b643702b31a4dedc7cfe5b67a798f2e6cd (patch)
tree64c70a907f764e3ccfd924281681c885695fec1b /commands/msgview
parent1b7790553e04816c3dd677848b2584ffd6785220 (diff)
Make part encoding checks case insensitive
commands/msgview/save and commands/msgview/pipe now use case insensitive comparisons to determine if the part is encoded as base64 or quoted-printable.
Diffstat (limited to 'commands/msgview')
-rw-r--r--commands/msgview/pipe.go6
-rw-r--r--commands/msgview/save.go7
2 files changed, 7 insertions, 6 deletions
diff --git a/commands/msgview/pipe.go b/commands/msgview/pipe.go
index 81cef7d..a84cdf5 100644
--- a/commands/msgview/pipe.go
+++ b/commands/msgview/pipe.go
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"mime/quotedprintable"
+ "strings"
"git.sr.ht/~sircmpwn/aerc/commands"
"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -25,10 +26,9 @@ func Pipe(aerc *widgets.Aerc, args []string) error {
p.Store.FetchBodyPart(p.Msg.Uid, p.Index, func(reader io.Reader) {
// email parts are encoded as 7bit (plaintext), quoted-printable, or base64
- switch p.Part.Encoding {
- case "base64":
+ if strings.EqualFold(p.Part.Encoding, "base64") {
reader = base64.NewDecoder(base64.StdEncoding, reader)
- case "quoted-printable":
+ } else if strings.EqualFold(p.Part.Encoding, "quoted-printable") {
reader = quotedprintable.NewReader(reader)
}
diff --git a/commands/msgview/save.go b/commands/msgview/save.go
index b15f42d..eff9c66 100644
--- a/commands/msgview/save.go
+++ b/commands/msgview/save.go
@@ -7,6 +7,7 @@ import (
"mime/quotedprintable"
"os"
"path/filepath"
+ "strings"
"time"
"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -43,10 +44,10 @@ func Save(aerc *widgets.Aerc, args []string) error {
p.Store.FetchBodyPart(p.Msg.Uid, p.Index, func(reader io.Reader) {
// email parts are encoded as 7bit (plaintext), quoted-printable, or base64
- switch p.Part.Encoding {
- case "base64":
+
+ if strings.EqualFold(p.Part.Encoding, "base64") {
reader = base64.NewDecoder(base64.StdEncoding, reader)
- case "quoted-printable":
+ } else if strings.EqualFold(p.Part.Encoding, "quoted-printable") {
reader = quotedprintable.NewReader(reader)
}