From 7d442be800c54c0b370af0af4b2529756b95425a Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 1 Nov 2016 08:10:51 -0700 Subject: [PATCH] Project.pm: clean up email address lists Use the new clean_email_multi function to clean up address lists provided via the web UI before storing them in the project. Signed-off-by: Kyle J. McKay --- Girocco/Project.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Girocco/Project.pm b/Girocco/Project.pm index ed36c03..00af75e 100644 --- a/Girocco/Project.pm +++ b/Girocco/Project.pm @@ -718,10 +718,11 @@ sub cgi_fill { $self->{tags_to_delete} = [$cgi->multi_param('tags')]; if ($field_enabled->('notifymail')) { - $self->{notifymail} = $gcgi->wparam('notifymail'); - if ($self->{notifymail}) { - (valid_email_multi($self->{notifymail}) and length($self->{notifymail}) <= 512) - or $gcgi->err("Invalid notify e-mail address. Use mail,mail to specify multiple addresses; total length must not exceed 512 characters, however."); + my $newaddrs = clean_email_multi($gcgi->wparam('notifymail')); + if ($newaddrs eq "" or (valid_email_multi($newaddrs) and length($newaddrs) <= 512)) { + $self->{notifymail} = $newaddrs; + } else { + $gcgi->err("Invalid notify e-mail address. Use mail,mail to specify multiple addresses; total length must not exceed 512 characters, however."); } if ($field_enabled->('reverseorder')) { $self->{reverseorder} = $gcgi->wparam('reverseorder') || 0; @@ -732,10 +733,11 @@ sub cgi_fill { } if ($field_enabled->('notifytag')) { - $self->{notifytag} = $gcgi->wparam('notifytag'); - if ($self->{notifytag}) { - (valid_email_multi($self->{notifytag}) and length($self->{notifytag}) <= 512) - or $gcgi->err("Invalid notify e-mail address. Use mail,mail to specify multiple addresses; total length must not exceed 512 characters, however."); + my $newaddrs = clean_email_multi($gcgi->wparam('notifytag')); + if ($newaddrs eq "" or (valid_email_multi($newaddrs) and length($newaddrs) <= 512)) { + $self->{notifytag} = $newaddrs; + } else { + $gcgi->err("Invalid notify e-mail address. Use mail,mail to specify multiple addresses; total length must not exceed 512 characters, however."); } } -- 2.11.4.GIT