Skip to content

Commit 5c47ad1

Browse files
mercataemersion
authored andcommitted
imapserver, imapclient: use lowercase for body encoding
The ABNF uses upper-case in body-fld-enc, however Dovecot uses lower-case and Outlook for iOS breaks with upper-case encodings.
1 parent e48e15e commit 5c47ad1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

imapclient/fetch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,9 @@ func readBodyType1part(dec *imapwire.Decoder, typ string, options *Options) (*im
975975
}
976976

977977
// Content-Transfer-Encoding should always be set, but some non-standard
978-
// servers leave it NIL. Default to 7BIT.
978+
// servers leave it NIL. Default to 7bit.
979979
if bs.Encoding == "" {
980-
bs.Encoding = "7BIT"
980+
bs.Encoding = "7bit"
981981
}
982982

983983
// TODO: handle errors

imapserver/fetch.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,10 @@ func writeBodyType1part(enc *imapwire.Encoder, bs *imap.BodyStructureSinglePart,
615615
writeNString(enc, bs.Description)
616616
enc.SP()
617617
if bs.Encoding == "" {
618-
enc.String("7BIT")
618+
enc.String("7bit")
619619
} else {
620-
enc.String(strings.ToUpper(bs.Encoding))
620+
// Outlook for iOS chokes on upper-case encodings
621+
enc.String(strings.ToLower(bs.Encoding))
621622
}
622623
enc.SP().Number(bs.Size)
623624

0 commit comments

Comments
 (0)