Skip to content

Commit a01f211

Browse files
Potential fix for code scanning alert no. 2: Incomplete string escaping or encoding
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent aeb8249 commit a01f211

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/generate-colors.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function toTsObject(data: unknown, indent: number = 2): string {
105105
if (data === null || data === undefined) return 'null';
106106

107107
if (typeof data === 'string') {
108-
return `'${data.replace(/'/g, "\\'").replace(/\n/g, '\\n')}'`;
108+
return `'${data.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\n/g, '\\n')}'`;
109109
}
110110

111111
if (typeof data === 'number' || typeof data === 'boolean') {

0 commit comments

Comments
 (0)