use Debbugs::Log qw(read_log_records);
use Debbugs::CGI qw(:url :html :util);
use Debbugs::CGI::Bugreport qw(:all);
-use Debbugs::Common qw(buglog getmaintainers);
+use Debbugs::Common qw(buglog getmaintainers make_list);
use Debbugs::Packages qw(getpkgsrc);
use Debbugs::Status qw(splitpackages get_bug_status isstrongseverity);
use Debbugs::Text qw(:templates);
+
use CGI::Simple;
my $q = new CGI::Simple;
my $mbox = $param{'mbox'} eq 'yes';
my $mime = $param{'mime'} eq 'yes';
+my %bugusertags;
+my %ut;
+my %seen_users;
+
+for my $user (map {split /[\s*,\s*]+/} make_list($param{users}||[])) {
+ next unless length($user);
+ add_user($user,\%ut,\%bugusertags,\%seen_users);
+}
+
+if (defined $param{usertag}) {
+ for my $usertag (make_list($param{usertag})) {
+ my %select_ut = ();
+ my ($u, $t) = split /:/, $usertag, 2;
+ Debbugs::User::read_usertags(\%select_ut, $u);
+ unless (defined $t && $t ne "") {
+ $t = join(",", keys(%select_ut));
+ }
+ add_user($u,\%ut,\%bugusertags,\%seen_users);
+ push @{$param{tag}}, split /,/, $t;
+ }
+}
+
+
my $trim_headers = ($param{trim} || ((defined $msg and $msg)?'no':'yes')) eq 'yes';
my $mbox_status_message = $param{mboxstat} eq 'yes';
my $repeatmerged = $param{'repeatmerged'} eq 'yes';
my $buglog = buglog($ref);
+if (not defined $buglog) {
+ print $q->header(-status => "404 No such bug",
+ -type => "text/html",
+ -charset => 'utf-8',
+ );
+ print fill_in_template(template=>'cgi/no_such_bug',
+ variables => {modify_time => strftime('%a, %e %b %Y %T UTC', gmtime),
+ bug_num => $ref,
+ },
+ );
+ exit 0;
+}
+
my @stat = stat $buglog;
my $mtime = '';
if (@stat) {
}
-my %status = %{get_bug_status(bug=>$ref)};
+my %status = %{get_bug_status(bug=>$ref,
+ bugusertags => \%bugusertags,
+ )};
my @records;
eval{
if ( $mbox ) {
my $date = strftime "%a %b %d %T %Y", localtime;
if (@records > 1) {
- print qq(Content-Disposition: attachment; filename="bug_${ref}.mbox"\n);
- print "Content-Type: text/plain\n\n";
+ print $q->header(-type => "text/plain",
+ content_disposition => qq(attachment; filename="bug_${ref}.mbox"),
+ (length $mtime)?(-last_modified => $mtime):(),
+ );
}
else {
$msg_num++;
- print qq(Content-Disposition: attachment; filename="bug_${ref}_message_${msg_num}.mbox"\n);
- print "Content-Type: message/rfc822\n\n";
+ print $q->header(-type => "message/rfc822",
+ content_disposition => qq(attachment; filename="bug_${ref}_message_${msg_num}.mbox"),
+ (length $mtime)?(-last_modified => $mtime):(),
+ );
}
if ($mbox_status_message and @records > 1) {
my $status_message='';
foreach my $pkg (@packages) {
$package{$pkg} = {maintainer => exists($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)',
- source => exists($pkgsrc{$pkg}) ? $pkgsrc{$pkg} : '(unknown)',
+ exists($pkgsrc{$pkg}) ? (source => $pkgsrc{$pkg}) : (),
package => $pkg,
};
}
log => $log,
bug_num => $ref,
version_graph => $version_graph,
+ msg => $msg,
isstrongseverity => \&Debbugs::Status::isstrongseverity,
html_escape => \&Debbugs::CGI::html_escape,
looks_like_number => \&Scalar::Util::looks_like_number,
'&version_url' => \&Debbugs::CGI::version_url,
'&bug_url' => \&Debbugs::CGI::bug_url,
'&strftime' => \&POSIX::strftime,
- }
+ '&maybelink' => \&Debbugs::CGI::maybelink,
+ },
);