Skip to content

Commit

Permalink
Merge pull request #28 from lightning-js/fix/codegenerator-single-quotes
Browse files Browse the repository at this point in the history
Fixes unescaped single quotes issue for content values
  • Loading branch information
michielvandergeest authored Jan 8, 2024
2 parents 7370341 + 6080a42 commit eda588a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/codegenerator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ const cast = (val = '', key = false, component = 'component.') => {
if (val.startsWith('$')) {
castedValue = `${component}${val.replace('$', '')}`
} else {
castedValue = `'${parseInlineContent(val, component)}'`
// unescaped single quotes must be escaped
castedValue = `'${parseInlineContent(val.replace(/(?<!\\)'/g, "\\'"), component)}'`
}
}
// numeric
Expand Down

0 comments on commit eda588a

Please sign in to comment.