aboutsummaryrefslogtreecommitdiffstats
path: root/lib/format
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-08-24 23:01:18 +0200
committerReto Brunner <reto@labrat.space>2020-08-24 23:28:18 +0200
commitb6ef116c36e1a1de6a2289f392603fd51a2b91da (patch)
treee78c459a69f78ac0e88f86c7633831e2be6e5c30 /lib/format
parenteb1439c2417a7f85c80249d63821e10027d7d329 (diff)
downloadaerc-b6ef116c36e1a1de6a2289f392603fd51a2b91da.tar.gz
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>
Diffstat (limited to 'lib/format')
-rw-r--r--lib/format/format.go6
1 files changed, 6 insertions, 0 deletions
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},
}