[tools] testbot/web: Escape the GetTaskURL() ampersands.
Francois Gouget
fgouget at codeweavers.com
Thu Apr 21 09:25:02 CDT 2022
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
See also the corresponding user details patch.
---
testbot/web/Activity.pl | 2 +-
testbot/web/Stats.pl | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/testbot/web/Activity.pl b/testbot/web/Activity.pl
index 5a5a37505..a92435805 100644
--- a/testbot/web/Activity.pl
+++ b/testbot/web/Activity.pl
@@ -238,7 +238,7 @@ EOF
$Label .= "/64" if ($Bitness);
}
}
- my $URL = GetTaskURL($VMStatus->{job}->Id, $VMStatus->{step}->No, $VMStatus->{task}->No);
+ my $URL = $self->escapeHTML(GetTaskURL($VMStatus->{job}->Id, $VMStatus->{step}->No, $VMStatus->{task}->No));
my $Title = $self->escapeHTML($VMStatus->{job}->Remarks);
$Label = "<a href='$URL' title='$Title'>$Label</a>";
}
diff --git a/testbot/web/Stats.pl b/testbot/web/Stats.pl
index 3c0fe9990..773fe3bb9 100644
--- a/testbot/web/Stats.pl
+++ b/testbot/web/Stats.pl
@@ -147,7 +147,7 @@ sub _GetStatHtml($$;$$)
my ($JobId, $StepNo, $TaskNo) = ObjectModel::Collection::SplitKey(undef, $SrcObj->GetFullKey());
if (defined $TaskNo)
{
- return "<a href='". GetTaskURL($JobId, $StepNo, $TaskNo) ."'>$Value</a>";
+ return "<a href='". $Stats->{Page}->escapeHTML(GetTaskURL($JobId, $StepNo, $TaskNo)) ."'>$Value</a>";
}
return "<a href='/index.pl#job$JobId'>$Value</a>";
}
@@ -174,6 +174,7 @@ sub _GenStatsLine($$$$;$)
foreach my $Col (@$ColumnKeys)
{
my $Stats = $RowStats->{items}->{$Col};
+ $Stats->{Page} = $RowStats->{Page};
my $Value = _GetStatHtml($Stats, $StatKey, $RowStats, $Flags);
print "<td>$Value</td>\n";
}
@@ -205,6 +206,7 @@ sub GenerateBody($)
### Show global statistics
my $GlobalStats = $Stats->{global};
+ $GlobalStats->{Page} = $self;
print "<h2>General statistics</h2>\n";
print "<div class='CollectionBlock'><table>\n";
@@ -251,6 +253,7 @@ sub GenerateBody($)
print "<tr><td class='StatSeparator'>Activity</td><td colspan='2'><hr></td></tr>\n";
my $VMsStats = $Stats->{vms};
+ $VMsStats->{Page} = $self;
_GenGlobalLine($VMsStats, "elapsed", "Activity history", "How far back the activity records go. This is used for the VM and VM host tables.");
_GenGlobalLine($GlobalStats, "records.count", "Record count", "The number of activity records.");
@@ -264,7 +267,8 @@ sub GenerateBody($)
print "<thead><tr><th>Stat</th>\n";
my $HostsStats = $Stats->{hosts};
- my $SortedHosts = [ sort keys %{$Stats->{hosts}->{items}} ];
+ $HostsStats->{Page} = $self;
+ my $SortedHosts = [ sort keys %{$HostsStats->{items}} ];
foreach my $Host (@$SortedHosts)
{
my $DisplayHost = $Host;
--
2.30.2
More information about the wine-devel
mailing list