mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
fix: escaping in action rule templating (#3632)
* fix: escaping in action rule templating * chore: release note
This commit is contained in:
committed by
GitHub
parent
37ad584826
commit
05dda5f9d7
@@ -327,6 +327,16 @@ describe('Action', () => {
|
||||
expect(item.notes).toBe('Hey Sarah! You just payed 10');
|
||||
});
|
||||
|
||||
test('should not escape text', () => {
|
||||
const action = new Action('set', 'notes', '', {
|
||||
template: '{{notes}}',
|
||||
});
|
||||
const note = 'Sarah !@#$%^&*()<> Special';
|
||||
const item = { notes: note };
|
||||
action.exec(item);
|
||||
expect(item.notes).toBe(note);
|
||||
});
|
||||
|
||||
describe('regex helper', () => {
|
||||
function testHelper(template: string, expected: unknown) {
|
||||
test(template, () => {
|
||||
|
||||
@@ -565,7 +565,9 @@ export class Action {
|
||||
this.field = field;
|
||||
this.type = typeName;
|
||||
if (options?.template) {
|
||||
this.handlebarsTemplate = Handlebars.compile(options.template);
|
||||
this.handlebarsTemplate = Handlebars.compile(options.template, {
|
||||
noEscape: true,
|
||||
});
|
||||
try {
|
||||
this.handlebarsTemplate({});
|
||||
} catch (e) {
|
||||
|
||||
6
upcoming-release-notes/3632.md
Normal file
6
upcoming-release-notes/3632.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [UnderKoen]
|
||||
---
|
||||
|
||||
Fix escaping in action rules templating
|
||||
Reference in New Issue
Block a user