]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2005-07-31 04:43:01 by don]
authordon <>
Sun, 31 Jul 2005 11:43:01 +0000 (03:43 -0800)
committerdon <>
Sun, 31 Jul 2005 11:43:01 +0000 (03:43 -0800)
* 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
debian/changelog

index 99404dfd3a129be924c2287753157449d00dd7de..d9c95457f71b9cd2911abeb6010431c900030af0 100755 (executable)
@@ -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~-]+?/?)((\&gt\;)?[)]?[']?[:.\,]?(\s|$)),<a href=\"$1\">$1</a>$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,'<a href="'.bugurl($bug,'').qq(">$bug</a>);
+     }
+     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|\.<|$)),<a href=\"$1\">$1</a>$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 .= '<a href="' . bugurl($ref, 'msg='.($msg_number+1)) . '">Full text</a> and <a href="' .
               bugurl($ref, 'msg='.($msg_number+1)) . '&mbox=yes">rfc822 format</a> available.</em>';
      }
index 5c9aff723a092ee544cfc18de8d9640743065705..5aede6fe6db0c224bf4d9ad4d4de95fec74902bc 100644 (file)
@@ -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 <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100