Skip to content

Commit f8e8e50

Browse files
fix: 🐛 Escape '>' character in JavaScript data insertion
* Updated the data insertion logic to properly escape the '>' character in addition to '<'. * This change prevents potential issues with JavaScript code execution when HTML tags are included in the data.
1 parent 2c4b6fe commit f8e8e50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Public/New-HTMLTable.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@
13251325
# If InvokeHTMLTags is not set, we need to escape HTML characters
13261326
# By default HTML tags are escaped when using DataStore HTML, but not when using JavaScript
13271327
# So we need to escape them here, so they don't break the JavaScript code
1328-
$DataToInsert = $DataToInsert -replace "<", "&lt;" -replace ">"
1328+
$DataToInsert = $DataToInsert -replace "<", "&lt;" -replace ">", "&gt;"
13291329
}
13301330
if ($DataToInsert.StartsWith('[')) {
13311331
$Script:HTMLSchema.CustomFooterJS[$DataStoreID] = "var $DataStoreID = $DataToInsert;"

0 commit comments

Comments
 (0)