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 dfc66beeff
commit c38ce0e0d9
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -160,8 +160,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>',