Commit dea6f731 authored by Alberto Bertogli's avatar Alberto Bertogli

aliases: Treat empty pipe aliases as bad lines and skip them

A pipe alias must have a command, if it doesn't, we should treat the
line as bad and skip it like we do for others.
parent 5f72f723
......@@ -307,6 +307,10 @@ func parseReader(domain string, r io.Reader) (map[string][]Recipient, error) {
if rawalias[0] == '|' {
cmd := strings.TrimSpace(rawalias[1:])
if cmd == "" {
// A pipe alias without a command is invalid.
aliases[addr] = []Recipient{{cmd, PIPE}}
} else {
rs := []Recipient{}
......@@ -198,6 +198,10 @@ func TestAddFile(t *testing.T) {
{"a: [email protected], [email protected], g\n",
[]Recipient{{"[email protected]", EMAIL}, {"[email protected]", EMAIL}, {"[email protected]", EMAIL}}},
// Invalid pipe aliases, should be ignored.
{"a:|\n", []Recipient{{"[email protected]", EMAIL}}},
{"a:| \n", []Recipient{{"[email protected]", EMAIL}}},
for _, c := range cases {
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment