]> Cypherpunks repositories - gostls13.git/commitdiff
net/mail: AddressList fails to parse addresses with a dot
authorRyan Slade <ryanslade@gmail.com>
Thu, 8 Aug 2013 17:00:24 +0000 (10:00 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 8 Aug 2013 17:00:24 +0000 (10:00 -0700)
Fixes #4938.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12657044

src/pkg/net/mail/message.go
src/pkg/net/mail/message_test.go

index 96c796e7804e77fc13697b7b333edba635cc9038..7cec302965723ba49aef43414c6179936b94872e 100644 (file)
@@ -342,7 +342,7 @@ func (p *addrParser) consumePhrase() (phrase string, err error) {
                        word, err = p.consumeQuotedString()
                } else {
                        // atom
-                       word, err = p.consumeAtom(false)
+                       word, err = p.consumeAtom(true)
                }
 
                // RFC 2047 encoded-word starts with =?, ends with ?=, and has two other ?s.
index 2e746f4a722c8422b12b7ff8257bfeb676866430..3c037f38385209ec3b23555d7d5c0a9475359370 100644 (file)
@@ -225,6 +225,16 @@ func TestAddressParsing(t *testing.T) {
                                },
                        },
                },
+               // Custom example with "." in name. For issue 4938
+               {
+                       `Asem H. <noreply@example.com>`,
+                       []*Address{
+                               {
+                                       Name:    `Asem H.`,
+                                       Address: "noreply@example.com",
+                               },
+                       },
+               },
        }
        for _, test := range tests {
                if len(test.exp) == 1 {