Correct some problems formatting links in query-pr.cgi's output.
The patch is from [1], and the problem was reported in both of the following PR: www/51607, www/53530 [1] Submitted by: anholt, eik [1]
This commit is contained in:
parent
23e5dc855a
commit
750c390701
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=18819
1 changed files with 20 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/perl -T
|
||||
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.34 2003/06/08 20:59:51 ceri Exp $
|
||||
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.35 2003/06/09 14:58:00 ceri Exp $
|
||||
|
||||
$ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin";
|
||||
|
||||
|
|
@ -219,13 +219,23 @@ sub srcref {
|
|||
}
|
||||
|
||||
sub fixline {
|
||||
local($line) = shift;
|
||||
|
||||
$line =~ s/&/&/g;
|
||||
$line =~ s/</</g;
|
||||
$line =~ s/>/>/g;
|
||||
$line =~ s%((http|ftp)://[^\s"\)\>,;]+)%<A HREF="$1">$1</A>%gi;
|
||||
$line =~ s%(\WPR[:s# \t]+)([a-z3486]+\/)?([0-9]+)%$1<A HREF="query-pr.cgi?pr=$3">$2$3</A>%ig;
|
||||
|
||||
return &srcref($line);
|
||||
local(@splitline) = split(/((?:https?|ftp):\/\/[^\s"\(\)<>,;]+)/, shift);
|
||||
|
||||
local($isurl) = 0;
|
||||
foreach (@splitline) {
|
||||
if ($isurl) {
|
||||
local($href) = local($html) = $_;
|
||||
$href =~ s/&/%26/g;
|
||||
$html =~ s/&/&/g;
|
||||
$_ = "<A HREF=\"$href\">$html</A>";
|
||||
} else {
|
||||
s/&/&/g;
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
s%(\WPR[:s# \t]+)([a-z3486]+\/)?([0-9]+)%$1<A HREF="query-pr.cgi?pr=$3">$2$3</A>%ig;
|
||||
}
|
||||
$isurl = ! $isurl;
|
||||
}
|
||||
|
||||
return &srcref(join('', @splitline));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue