__end_control(%info);
}
+= head2 valid_usertag
+
+ valid_usertag
+
+This checks if the usertag contains valid characters or not.
+
+=cut
+
+sub valid_usertag {
+ my $usertag = shift;
+ return $usertag =~ m/^[a-zA-Z0-9.+\@-]+$/;
+}
+
+
=head2 append_action_to_log
append_action_to_log
use Debbugs::Config qw(:globals :config);
-use Debbugs::Control qw(append_action_to_log);
+use Debbugs::Control qw(append_action_to_log valid_usertag);
use Debbugs::Control::Service qw(valid_control control_line);
use Debbugs::Recipients qw(determine_recipients);
use Encode qw(encode_utf8 decode);
read_usertags(\%user_tags, $current_user);
$value =~ s/(?:^\s+|\s+$)//g;
for my $tag (split /[,\s]+/, $value) {
- if ($tag =~ /^[a-zA-Z0-9.+\@-]+/) {
+ if (valid_usertag($tag)) {
my %bugs_with_tag;
@bugs_with_tag{@{$user_tags{$tag}||[]}} = (1) x @{$user_tags{$tag}||[]};
$bugs_with_tag{$ref} = 1;
use Debbugs::Status qw(splitpackages);
use Debbugs::CGI qw(html_escape);
-use Debbugs::Control qw(:all);
+use Debbugs::Control qw(:all valid_usertag);
use Debbugs::Control::Service qw(:all);
use Debbugs::Log qw(:misc);
use Debbugs::Text qw(:templates);
my %chtags;
if (defined $tags and length $tags) {
for my $t (split /[,\s]+/, $tags) {
- if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
+ if (valid_usertag($t)) {
$chtags{$t} = 1;
} else {
push @badtags, $t;