]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2003-03-21 04:26:43 by cjwatson]
authorcjwatson <>
Fri, 21 Mar 2003 12:26:43 +0000 (04:26 -0800)
committercjwatson <>
Fri, 21 Mar 2003 12:26:43 +0000 (04:26 -0800)
Turn forwarded-to address into a link if it looks like it's in fact a URL.

cgi/bugreport.cgi
cgi/common.pl

index 9b4df6ac29a28fdb6083d95bb5a25988678f004b..35ff2697470b2e70b6dddf0d99513204a2915230 100755 (executable)
@@ -121,7 +121,7 @@ if (@merged) {
 if (length($status{done})) {
        push @descstates, "<strong>Done:</strong> ".htmlsanit($status{done});
 } elsif (length($status{forwarded})) {
-       push @descstates, "<strong>Forwarded</strong> to ".htmlsanit($status{forwarded});
+       push @descstates, "<strong>Forwarded</strong> to ".maybelink($status{forwarded});
 }
 
 $indexentry .= join(";\n", @descstates) . ";\n<br>" if @descstates;
index 202d0c92d7d7a2ac37299241b7ae8585bc48ec80..303d317c303792b989220c9b49c75ef9c742c776 100644 (file)
@@ -176,7 +176,7 @@ sub htmlindexentrystatus {
     } else {
         if (length($status{forwarded})) {
             $result .= ";\n<strong>Forwarded</strong> to "
-                       . htmlsanit($status{forwarded});
+                       . maybelink($status{forwarded});
         }
         my $daysold = int((time - $status{date}) / 86400);   # seconds to days
         if ($daysold >= 7) {
@@ -255,6 +255,15 @@ sub htmlsanit {
     return $in;
 }
 
+sub maybelink {
+    my $in = shift;
+    if ($in =~ /^[a-zA-Z0-9+.-]+:/) { # RFC 1738 scheme
+       return qq{<a href="$in">} . htmlsanit($in) . '</a>';
+    } else {
+       return htmlsanit($in);
+    }
+}
+
 sub bugurl {
     my $ref = shift;
     my $params = "bug=$ref";