Update samy.ps1

This commit is contained in:
2025-12-20 20:31:56 -05:00
parent bf3779a104
commit 5756f23571

View File

@@ -756,16 +756,20 @@ if (-not $Global:SamyTasks) {
function Escape-HtmlAttr { function Escape-HtmlAttr {
param([string]$s) param([string]$s)
if ([string]::IsNullOrEmpty($s)) { return '' } if ([string]::IsNullOrEmpty($s)) { return '' }
$s = $s -replace '&','&'
$s = $s -replace '"','"' $s = $s -replace "(`r`n|`r|`n)", ' '
$s = $s -replace '<','&lt;' $s = $s -replace '&','&amp;'
$s = $s -replace '>','&gt;' $s = $s -replace '"','&quot;'
return $s $s = $s -replace "'",'&#39;'
$s = $s -replace '<','&lt;'
$s = $s -replace '>','&gt;'
return $s
} }
function Escape-HtmlText { function Escape-HtmlText {
param([string]$s) param([string]$s)
if ([string]::IsNullOrEmpty($s)) { return '' } if ([string]::IsNullOrEmpty($s)) { return '' }
$s = $s -replace '&','&amp;' $s = $s -replace '&','&amp;'
$s = $s -replace '<','&lt;' $s = $s -replace '<','&lt;'
$s = $s -replace '>','&gt;' $s = $s -replace '>','&gt;'
@@ -792,7 +796,8 @@ if (-not $Global:SamyTasks) {
} }
$tooltipText = Escape-HtmlAttr $rawTooltip $tooltipText = Escape-HtmlAttr $rawTooltip
$tooltipAttr = if ([string]::IsNullOrWhiteSpace($tooltipText)) { '' } else { " title=""$tooltipText""" } $tooltipAttr = if ([string]::IsNullOrWhiteSpace($tooltipText)) { '' } else { " title=`"$tooltipText`"" }
$labelText = Escape-HtmlText ([string]$_.Label) $labelText = Escape-HtmlText ([string]$_.Label)