From: Don Armstrong Date: Wed, 22 Mar 2006 10:17:29 +0000 (-0800) Subject: * Add close: linkage; ditch useless output cleanup in MIME::Parser X-Git-Tag: release/2.6.0~619^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f634cca4ab0a713289adf99faf4bc9a124cc7164;p=debbugs.git * Add close: linkage; ditch useless output cleanup in MIME::Parser --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index b1196baf..5746b4f6 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -157,9 +157,15 @@ sub display_entity ($$$$\$\@) { $body = convert_to_utf8($body,$charset) if defined $charset; $body = htmlsanit($body); $body =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go; - $$this .= "
";
-	      $$this .= $body;
-	      $$this .= "
\n"; + # The basic idea here is that we take every subpart of + # this regex; if it's a digit, it's a bug number, so link + # it; otherwise it's some other part, so kick it back + # out. + our @bugs; + $body =~ s[(?:(closes:\s*(?:bug)?\#?\s?)(?{ push @bugs, $^N })) #This sticks the recently closed parenthetical into @bugs + (?:(\d+)(?{ push @bugs, $^N }))(?:(?:(,?\s*(?:bug)?\#?\s?)(?{push @bugs, $^N }))(?:(\d+)(?{ push @bugs, $^N })))* + ][join('',map {/^\d+$/?(q($_)):$_} splice @bugs)]gxie; + $$this .= qq(
$body
\n); } } } @@ -343,13 +349,11 @@ sub handle_email_message{ my $output = ''; my $parser = new MIME::Parser; + # Because we are using memory, not tempfiles, there's no need to + # clean up here like in Debbugs::MIME $parser->tmp_to_core(1); $parser->output_to_core(1); - # $parser->output_under("/tmp"); my $entity = $parser->parse_data( $email); - # TODO: make local subdir, clean it ourselves - # the following does NOT delete the msg dirs in /tmp - END { if ( $entity ) { $entity->purge; } if ( $parser ) { $parser->filer->purge; } } my @attachments = (); display_entity($entity, $options{ref}, 1, $options{msg_number}, $output, @attachments); return $output;