Update samy.ps1

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

View File

@@ -756,8 +756,11 @@ if (-not $Global:SamyTasks) {
function Escape-HtmlAttr {
param([string]$s)
if ([string]::IsNullOrEmpty($s)) { return '' }
$s = $s -replace "(`r`n|`r|`n)", ' '
$s = $s -replace '&','&'
$s = $s -replace '"','"'
$s = $s -replace "'",'''
$s = $s -replace '<','&lt;'
$s = $s -replace '>','&gt;'
return $s
@@ -766,6 +769,7 @@ if (-not $Global:SamyTasks) {
function Escape-HtmlText {
param([string]$s)
if ([string]::IsNullOrEmpty($s)) { return '' }
$s = $s -replace '&','&amp;'
$s = $s -replace '<','&lt;'
$s = $s -replace '>','&gt;'
@@ -792,7 +796,8 @@ if (-not $Global:SamyTasks) {
}
$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)