]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Control.pm
Fix default user for usertags
[debbugs.git] / Debbugs / Control.pm
index 6b2ab9181025df9663719c9b5f9ce612362b8504..4396b057f2ff697369f4abd53912b0df62b6ae61 100644 (file)
@@ -96,7 +96,7 @@ BEGIN{
                     package => [qw(set_package)],
                     block   => [qw(set_blocks)],
                     merge   => [qw(set_merged)],
-                    tag     => [qw(set_tag)],
+                    tag     => [qw(set_tag valid_usertag)],
                     clone   => [qw(clone_bug)],
                     archive => [qw(bug_archive bug_unarchive),
                                ],
@@ -3246,6 +3246,15 @@ sub bug_unarchive {
      my @bugs = @{$info{bugs}};
      my $action = "$config{bug} unarchived.";
      my @files_to_remove;
+     ## error out if we're unarchiving unarchived bugs
+     for my $data (@{$info{data}}) {
+        if (not defined $data->{archived} or
+            not $data->{archived}
+           ) {
+            __end_control(%info);
+            croak("Bug $data->{bug_num} was not archived; not unarchiving it.");
+        }
+     }
      for my $bug (@bugs) {
          print {$debug} "$param{bug} removing $bug\n";
          my $dir = get_hashname($bug);
@@ -3286,6 +3295,20 @@ sub bug_unarchive {
      __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