diff --git a/plugin.go b/plugin.go index 726292f..877631b 100644 --- a/plugin.go +++ b/plugin.go @@ -141,7 +141,7 @@ func parseTo(to []string, authorEmail string, matchEmail bool) []int64 { var ids []int64 attachEmail := true - for _, value := range to { + for _, value := range trimElement(to) { idArray := trimElement(strings.Split(value, ":")) // check id diff --git a/plugin_test.go b/plugin_test.go index ba541d3..e8212d2 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -146,6 +146,10 @@ func TestParseTo(t *testing.T) { ids = parseTo(input, "a@gmail.com", true) assert.Equal(t, []int64{0, 4, 5}, ids) + + // test empty ids + ids = parseTo([]string{"", " ", " "}, "a@gmail.com", true) + assert.Equal(t, 0, len(ids)) } func TestCheckFileExist(t *testing.T) {