Skip to content

Commit

Permalink
fix: use extended parser after fixing address list
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Kasianenko committed Mar 14, 2022
1 parent 3d42481 commit 334850a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion header.go
Expand Up @@ -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
}
Expand Down
13 changes: 13 additions & 0 deletions header_test.go
Expand Up @@ -102,6 +102,19 @@ func TestParseAddressListResult(t *testing.T) {
},
},
},
{
`=?big5?Q?ext-encoding-without-comma?= <ext-encoding-wo-comma@example.com> <other@example.com>`,
[]*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) {
Expand Down

0 comments on commit 334850a

Please sign in to comment.