]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/bugreport.cgi
Fix mbox output of bugreports to properly use filehandle
[debbugs.git] / cgi / bugreport.cgi
index bf1db2d3ce3fa976945fdcbb6e9e4cdbf19c44e6..db4619d85d7fb3047978e153a41fa1bce131f51d 100755 (executable)
@@ -235,6 +235,8 @@ END
       if ($record->{inner_file}) {
           push @lines, $record->{fh}->getline;
           push @lines, $record->{fh}->getline;
+          chomp $lines[0];
+          chomp $lines[1];
       } else {
           @lines = split( "\n", $record->{text}, -1 );
       }
@@ -243,11 +245,12 @@ END
          }
          if ( !( $lines[ 0 ] =~ m/^From / ) ) {
               unshift @lines, "From unknown $date";
-         }
+       }
+      print $lines[0]."\n";
          print map { s/^(>*From )/>$1/; $_."\n" } @lines[ 1 .. $#lines ];
       if ($record->{inner_file}) {
           my $fh = $record->{fh};
-          print <$fh>;
+          print $_ while (<$fh>);
       }
      }
      exit 0;