Skip to content

Commit 2ccc4db

Browse files
committed
Use JSON.stringify for palette and gradient slug keys so backslashes are escaped correctly and CodeQL incomplete-escaping alert is resolved.
1 parent ff9475d commit 2ccc4db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎config/webpack-theme-json-plugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class WebpackThemeJsonPlugin {
143143

144144
// Quote map keys so slugs like black/white are strings, not Sass color literals.
145145
function formatMapKey(slug) {
146-
return `"${String(slug).replace(/"/g, '\\"')}"`
146+
return JSON.stringify(String(slug))
147147
}
148148

149149
// traverse the theme.json file and generate the scss variables

0 commit comments

Comments
 (0)