From c7c9acc8e49c81b9a2cb0a60e7820cae222146fa Mon Sep 17 00:00:00 2001
From: don <>
Date: Sun, 31 Jul 2005 03:43:01 -0800
Subject: [PATCH] [project @ 2005-07-31 04:43:01 by don] * Add links to cloned
bugs (closes: #217960) and forwarded records that look like urls in the
html records output by bugreport.cgi. * Things that look like urls in
message bodies are now linked (closes: #168962)
---
cgi/bugreport.cgi | 33 ++++++++++++++++++++++++++++++++-
debian/changelog | 4 ++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi
index 99404dfd..d9c95457 100755
--- a/cgi/bugreport.cgi
+++ b/cgi/bugreport.cgi
@@ -154,7 +154,9 @@ sub display_entity ($$$$\$\@) {
my ($charset) = $content_type =~ m/charset\s*=\s*\"?([\w-]+)\"?/i;
my $body = $entity->bodyhandle->as_string;
$body = convert_to_utf8($body,$charset) if defined $charset;
- $$this .= htmlsanit($body);
+ $body = htmlsanit($body);
+ $body =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go;
+ $$this .= $body;
}
}
}
@@ -321,6 +323,30 @@ sub handle_email_message{
}
+=head2 bug_links
+
+ bug_links($one_bug);
+ bug_links($starting_bug,$stoping_bugs,);
+
+Creates a set of links to bugs, starting with bug number
+$starting_bug, and finishing with $stoping_bug; if only one bug is
+passed, makes a link to only a single bug.
+
+The content of the link is the bug number.
+
+=cut
+
+sub bug_links{
+ my ($start,$stop,$query_arguments) = @_;
+ $stop = $stop || $start;
+ $query_arguments ||= '';
+ my @output;
+ for my $bug ($start..$stop) {
+ push @output,'$bug);
+ }
+ return join(', ',@output);
+}
+
=head2 handle_record
push @log, handle_record($record,$ref,$msg_num);
@@ -338,6 +364,11 @@ sub handle_record{
local $_ = $record->{type};
if (/html/) {
$output .= decode_rfc1522($record->{text});
+ # Link to forwarded http:// urls in the midst of the report
+ # (even though these links already exist at the top)
+ $output =~ s,((?:ftp|http|https)://[\S~-]+?/?)([\)\'\:\.\,]?(?:\s|\.<|$)),$1$2,go;
+ # Add links to the cloned bugs
+ $output =~ s{(Bug )(\d+)( cloned as bugs? )(\d+)(?:\-(\d+)|)}{$1.bug_links($2).$3.bug_links($4,$5)}eo;
$output .= 'Full text and rfc822 format available.';
}
diff --git a/debian/changelog b/debian/changelog
index 5c9aff72..5aede6fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -78,6 +78,10 @@ debbugs (2.4.2) UNRELEASED; urgency=low
- Display old severity when changing severity (closes: #196947)
- All messages that originate from the BTS and either go to .log files
or out to users are now properly RFC1522 encoded. (closes: #306068)
+ - Add links to cloned bugs (closes: #217960) and forwarded records
+ that look like urls in the html records output by bugreport.cgi.
+ - Things that look like urls in message bodies are now linked
+ (closes: #168962)
-- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100
--
2.39.5