fix(ui-templates): escape inline scripts correctly in ui templates

This commit is contained in:
Daniel Roe 2025-03-02 19:34:15 +00:00
parent 97ec3143a5
commit 39c2b0a2c4
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -157,8 +157,8 @@ export const RenderPlugin = () => {
`const props = defineProps(${props})`,
title && 'useHead(' + genObjectFromRawEntries([
['title', `\`${title}\``],
['script', inlineScripts.map(s => ({ children: `\`${s}\`` }))],
['style', [{ children: `\`${globalStyles}\`` }]],
['script', inlineScripts.map(s => ({ children: `\`${s.replace(/[`$]/g, '\\$&')}\`` }))],
['style', [{ children: `\`${globalStyles.replace(/[`$]/g, '\\$&')}\`` }]],
]) + ')',
'</script>',
'<template>',