From b6ef116c36e1a1de6a2289f392603fd51a2b91da Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Mon, 24 Aug 2020 23:01:18 +0200 Subject: 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 Tested-by: anianz --- lib/format/format.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/format/format.go b/lib/format/format.go index 656d8088..0eda7ae1 100644 --- a/lib/format/format.go +++ b/lib/format/format.go @@ -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}, } -- cgit