Ensure mimetype parts are converted to lower case

This ensures that the check for a text message to use in the reply is
performed (more) correctly and so uses the plaintext more often.
This commit is contained in:
Jeffas 2019-09-07 19:34:07 +01:00 committed by Drew DeVault
parent f6216bb621
commit 3c3bc517b5

View file

@ -194,10 +194,11 @@ func findPlaintext(bs *models.BodyStructure,
for i, part := range bs.Parts { for i, part := range bs.Parts {
cur := append(path, i+1) cur := append(path, i+1)
if part.MIMEType == "text" && part.MIMESubType == "plain" { if strings.ToLower(part.MIMEType) == "text" &&
strings.ToLower(part.MIMESubType) == "plain" {
return part, cur return part, cur
} }
if part.MIMEType == "multipart" { if strings.ToLower(part.MIMEType) == "multipart" {
if part, path := findPlaintext(part, cur); path != nil { if part, path := findPlaintext(part, cur); path != nil {
return part, path return part, path
} }