From 334850a38dfcbb072cc3bf7718a617508fa34c8a Mon Sep 17 00:00:00 2001 From: Dmytro Kasianenko Date: Mon, 14 Mar 2022 18:09:34 +0100 Subject: [PATCH] fix: use extended parser after fixing address list --- header.go | 2 +- header_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/header.go b/header.go index d1d78458..52591edc 100644 --- a/header.go +++ b/header.go @@ -85,7 +85,7 @@ func ParseAddressList(list string) ([]*mail.Address, error) { switch err.Error() { case "mail: expected comma": // Attempt to add commas and parse again. - return mail.ParseAddressList(stringutil.EnsureCommaDelimitedAddresses(list)) + return parser.ParseList(stringutil.EnsureCommaDelimitedAddresses(list)) case "mail: no address": return nil, mail.ErrHeaderNotPresent } diff --git a/header_test.go b/header_test.go index 322e8e95..e31234b3 100644 --- a/header_test.go +++ b/header_test.go @@ -102,6 +102,19 @@ func TestParseAddressListResult(t *testing.T) { }, }, }, + { + `=?big5?Q?ext-encoding-without-comma?= `, + []*mail.Address{ + { + Name: "ext-encoding-without-comma", + Address: "ext-encoding-wo-comma@example.com", + }, + { + Name: "", + Address: "other@example.com", + }, + }, + }, } for _, tc := range testCases { t.Run(tc.input, func(t *testing.T) {