~sircmpwn/aerc

b6ef116c36e1a1de6a2289f392603fd51a2b91da — Reto Brunner a month ago eb1439c
ParseAddressList: return empty list if "" is provided

Go 1.15 handles "" in the address parser as a non error case, returning
an empty list.
Prior versions returned an error, which is not what we want.

Reported-by: anianz <a.ziegler@cioplenu.de>
Tested-by: anianz <a.ziegler@cioplenu.de>
1 files changed, 6 insertions(+), 0 deletions(-)

M lib/format/format.go
M lib/format/format.go => lib/format/format.go +6 -0
@@ 21,6 21,12 @@ func ParseAddress(address string) (*models.Address, error) {
}

func ParseAddressList(s string) ([]*models.Address, error) {
	if len(s) == 0 {
		// workaround for go versions < 1.15
		// 1.15 returns an empty list if "" is provided as input, prior versions
		// return an error which is not what we want
		return nil, nil
	}
	parser := gomail.AddressParser{
		&mime.WordDecoder{message.CharsetReader},
	}