diff --git a/imapserver/append_test.go b/imapserver/append_test.go index a81071d..45a883f 100644 --- a/imapserver/append_test.go +++ b/imapserver/append_test.go @@ -55,11 +55,11 @@ func TestAppend(t *testing.T) { tc3.transactf("ok", "noop") tc3.xuntagged() // Inbox is not selected, nothing to report. - tc2.transactf("ok", "append inbox (\\Seen) \" 1-Jan-2022 10:10:00 +0100\" UTF8 ({47+}\r\ncontent-type: just completely invalid;;\r\n\r\ntest)") + tc2.transactf("ok", "append inbox (\\Seen) \" 1-Jan-2022 10:10:00 +0100\" UTF8 (~{47+}\r\ncontent-type: just completely invalid;;\r\n\r\ntest)") tc2.xuntagged(imapclient.UntaggedExists(2)) tc2.xcodeArg(imapclient.CodeAppendUID{UIDValidity: 1, UIDs: xparseUIDRange("2")}) - tc2.transactf("ok", "append inbox (\\Seen) \" 1-Jan-2022 10:10:00 +0100\" UTF8 ({31+}\r\ncontent-type: text/plain;\n\ntest)") + tc2.transactf("ok", "append inbox (\\Seen) \" 1-Jan-2022 10:10:00 +0100\" UTF8 (~{31+}\r\ncontent-type: text/plain;\n\ntest)") tc2.xuntagged(imapclient.UntaggedExists(3)) tc2.xcodeArg(imapclient.CodeAppendUID{UIDValidity: 1, UIDs: xparseUIDRange("3")}) @@ -81,7 +81,7 @@ func TestAppend(t *testing.T) { // Multiappend with two messages. tc.transactf("ok", "noop") // Flush pending untagged responses. - tc.transactf("ok", "append inbox {6+}\r\ntest\r\n {6+}\r\ntost\r\n") + tc.transactf("ok", "append inbox {6+}\r\ntest\r\n ~{6+}\r\ntost\r\n") tc.xuntagged(imapclient.UntaggedExists(5)) tc.xcodeArg(imapclient.CodeAppendUID{UIDValidity: 1, UIDs: xparseUIDRange("4:5")}) diff --git a/imapserver/server.go b/imapserver/server.go index 95e8119..dd8d79b 100644 --- a/imapserver/server.go +++ b/imapserver/server.go @@ -3303,7 +3303,7 @@ func flaglist(fl store.Flags, keywords []string) listspace { // // State: Authenticated and selected. func (c *conn) cmdAppend(tag, cmd string, p *parser) { - // Command: ../rfc/9051:3406 ../rfc/6855:204 ../rfc/3501:2527 ../rfc/3502:95 + // Command: ../rfc/9051:3406 ../rfc/6855:204 ../rfc/4466:427 ../rfc/3501:2527 ../rfc/3502:95 // Examples: ../rfc/9051:3482 ../rfc/3501:2589 ../rfc/3502:175 // A message that we've (partially) read from the client, and will be delivering to @@ -3385,7 +3385,12 @@ func (c *conn) cmdAppend(tag, cmd string, p *parser) { // todo: this is only relevant if we also support the CATENATE extension? // ../rfc/6855:204 utf8 := p.take("UTF8 (") - size, synclit := p.xliteralSize(utf8, false) + if utf8 { + p.xtake("~") + } + // Always allow literal8, for binary extension. ../rfc/4466:486 + // For utf8, we already consumed the required ~ above. + size, synclit := p.xliteralSize(!utf8, false) if !quotaUnlimited && !overQuota { quotaAvail -= size