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>
This commit is contained in:
parent
eb1439c241
commit
b6ef116c36
1 changed files with 6 additions and 0 deletions
|
@ -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},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue