fix(plugin-workflow): fix formula validation for expression (#4957)

This commit is contained in:
Junyi 2024-07-31 09:56:19 +08:00 committed by GitHub
parent f7db3bd291
commit f713beae80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ export default class extends Instruction {
['x-validator'](value, rules, { form }) {
const { values } = form;
const { evaluate } = evaluators.get(values.engine) as Evaluator;
const exp = value.trim().replace(/{{([^{}]+)}}/g, ' 1 ');
const exp = value.trim().replace(/{{([^{}]+)}}/g, ' "1" ');
try {
evaluate(exp);
return '';

View File

@ -409,7 +409,7 @@ export default class extends Instruction {
['x-validator'](value, rules, { form }) {
const { values } = form;
const { evaluate } = evaluators.get(values.engine);
const exp = value.trim().replace(/{{([^{}]+)}}/g, ' 1 ');
const exp = value.trim().replace(/{{([^{}]+)}}/g, ' "1" ');
try {
evaluate(exp);
return '';