From b3557bc457ee50333c660c772032f9b7ed540dfd Mon Sep 17 00:00:00 2001 From: cjwatson <> Date: Fri, 21 Mar 2003 04:26:43 -0800 Subject: [PATCH] [project @ 2003-03-21 04:26:43 by cjwatson] Turn forwarded-to address into a link if it looks like it's in fact a URL. --- cgi/bugreport.cgi | 2 +- cgi/common.pl | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 9b4df6ac..35ff2697 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -121,7 +121,7 @@ if (@merged) { if (length($status{done})) { push @descstates, "Done: ".htmlsanit($status{done}); } elsif (length($status{forwarded})) { - push @descstates, "Forwarded to ".htmlsanit($status{forwarded}); + push @descstates, "Forwarded to ".maybelink($status{forwarded}); } $indexentry .= join(";\n", @descstates) . ";\n
" if @descstates; diff --git a/cgi/common.pl b/cgi/common.pl index 202d0c92..303d317c 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -176,7 +176,7 @@ sub htmlindexentrystatus { } else { if (length($status{forwarded})) { $result .= ";\nForwarded 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{} . htmlsanit($in) . ''; + } else { + return htmlsanit($in); + } +} + sub bugurl { my $ref = shift; my $params = "bug=$ref"; -- 2.39.5