1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:14:42 -07:00

net/mail: fix wrong error message in consumePhrase

Fixes #19415

Change-Id: I6414f82e42bd09f1793156befce326aeac919ea2
Reviewed-on: https://go-review.googlesource.com/37911
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Hiroshi Ioka 2017-03-08 07:47:31 +09:00 committed by Brad Fitzpatrick
parent c797256a8f
commit 2bd6360e3b
2 changed files with 2 additions and 1 deletions

View File

@ -393,7 +393,7 @@ func (p *addrParser) consumePhrase() (phrase string, err error) {
var word string var word string
p.skipSpace() p.skipSpace()
if p.empty() { if p.empty() {
return "", errors.New("mail: missing phrase") break
} }
isEncoded := false isEncoded := false
if p.peek() == '"' { if p.peek() == '"' {

View File

@ -136,6 +136,7 @@ func TestAddressParsingError(t *testing.T) {
4: {"\"\\" + string([]byte{0x80}) + "\" <escaped-invalid-unicode@example.net>", "invalid utf-8 in quoted-string"}, 4: {"\"\\" + string([]byte{0x80}) + "\" <escaped-invalid-unicode@example.net>", "invalid utf-8 in quoted-string"},
5: {"\"\x00\" <null@example.net>", "bad character in quoted-string"}, 5: {"\"\x00\" <null@example.net>", "bad character in quoted-string"},
6: {"\"\\\x00\" <escaped-null@example.net>", "bad character in quoted-string"}, 6: {"\"\\\x00\" <escaped-null@example.net>", "bad character in quoted-string"},
7: {"John Doe", "no angle-addr"},
} }
for i, tc := range mustErrTestCases { for i, tc := range mustErrTestCases {