]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
Fix handling of not present bugs
authorIan Campbell <ijc@hellion.org.uk>
Sun, 13 Jan 2013 17:39:00 +0000 (17:39 +0000)
committerIan Campbell <ijc@hellion.org.uk>
Sun, 13 Jan 2013 17:39:20 +0000 (17:39 +0000)
CGI/bug.pl

index d332ad0df67db91fb12db0763fd7461226deb16c..01670210d095576729e98e38fd4152b64792e7d2 100755 (executable)
@@ -203,22 +203,6 @@ foreach my $m ( sort msgcmp $bug->messages ) {
     my @body;
     my @parts;
 
-    if ( $m->{present} ) {
-        my $tempdir = File::Temp::tempdir();
-        my $e       = $m->get_mime($tempdir);
-        my $et      = $e->effective_type;
-        $bodyent = getmailbody($e);
-        push @body, $bodyent->bodyhandle->as_lines;
-        rmtree $tempdir, 0, 1;
-        @parts = getmailparts($e);
-
-        # Strip leading and trailing blank lines
-        shift @body while @body and $body[0] !~ /\S/;
-        pop @body   while @body and $body[$#body] !~ /\S/;
-    }
-    else {
-        @body = ("Message not present in archive\n");
-    }
     my @archives = archive_list( $m->{msgid} );
     print pre(
         { -class => "headers" },
@@ -243,14 +227,35 @@ foreach my $m ( sort msgcmp $bug->messages ) {
           . join( ", ", @archives ) . " ]"
     ) . "\n";
 
-    my $nr = 1;
-    foreach my $part (@parts) {
-        print pre( { -class => "mime" }, parthdr( $part, $m, $nr ) ) . "\n"
-          unless $#parts eq 0;
-        print pre( { -class => "body" }, htmlsanit( join( "", @body ) ) ) . "\n"
-          if $part == $bodyent;
-        $nr++;
+    if ( $m->{present} ) {
+        my $tempdir = File::Temp::tempdir();
+        my $e       = $m->get_mime($tempdir);
+        my $et      = $e->effective_type;
+        $bodyent = getmailbody($e);
+        push @body, $bodyent->bodyhandle->as_lines;
+        rmtree $tempdir, 0, 1;
+        @parts = getmailparts($e);
+
+        # Strip leading and trailing blank lines
+        shift @body while @body and $body[0] !~ /\S/;
+        pop @body   while @body and $body[$#body] !~ /\S/;
+
+        my $nr = 1;
+        foreach my $part (@parts) {
+            print pre( { -class => "mime" }, parthdr( $part, $m, $nr ) ) . "\n"
+              unless $#parts eq 0;
+            print pre( { -class => "body" }, htmlsanit( join( "", @body ) ) )
+              . "\n"
+              if $part == $bodyent;
+            $nr++;
+        }
     }
+    else {
+        @body = ("Message not present in archive\n");
+        print pre( { -class => "body" }, htmlsanit( join( "", @body ) ) )
+          . "\n";
+    }
+
     print hr . "\n";
 }