From: Don Armstrong Date: Thu, 23 Mar 2006 03:31:08 +0000 (-0800) Subject: * Change the closure regex to something more sane (and less buggy) X-Git-Tag: release/2.6.0~618^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6ffa5f9cf937b2a1c44728358a14e9b19ba5648c;p=debbugs.git * Change the closure regex to something more sane (and less buggy) --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 5746b4f6..16d6ecc2 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -156,15 +156,11 @@ sub display_entity ($$$$\$\@) { my $body = $entity->bodyhandle->as_string; $body = convert_to_utf8($body,$charset) if defined $charset; $body = htmlsanit($body); + # Add links to URLs $body =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go; - # 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; + # Add links to bug closures + $body =~ s[(closes:\s*(?:bug)?\#?\s?\d+(?:,?\s*(?:bug)?\#?\s?\d+)*) + ][my $temp = $1; $temp =~ s{(\d+)}{qq($1)}ge; $temp;]gxie; $$this .= qq(
$body
\n); } } @@ -408,6 +404,9 @@ sub handle_record{ $output =~ s{(Bug )(\d+)( cloned as bugs? )(\d+)(?:\-(\d+)|)}{$1.bug_links($2).$3.bug_links($4,$5)}eo; # Add links to merged bugs $output =~ s{(?<=Merged )([\d\s]+)(?=\.)}{join(' ',map {bug_links($_)} (split /\s+/, $1))}eo; + # Add links to reassigned packages + $output =~ s{(Bug reassigned from package \`)([^\']+)(' to \`)([^\']+)(')} + {$1.q($2).$3.q($4).$5}eo; $output .= 'Full text and rfc822 format available.';