[Bug] Fix broken variables for database event (#17526)

Fix https://github.com/twentyhq/twenty/issues/17524

Recent update meant to support variable with spaces and dots broken the
database event variables. Inserting a variable `My Name` will be
inserted as `{{trigger.[My Name]}}`

For example, for a database event, we send `trigger.properties.after.id`
instead of `id`.
With the new code, we will consider `properties.after.id` as a variable
to wrap in `[]`, giving `trigger.[properties.after.id]` which cannot be
resolve.

Let's only support variable with spaces. Removing the logic to wrap
variable with dots.
This commit is contained in:
Thomas Trompette
2026-01-28 17:05:59 +00:00
committed by GitHub
parent 3e9dda6761
commit 9672ca09a2
3 changed files with 2 additions and 25 deletions
@@ -1,6 +1,5 @@
// Characters that require bracket escaping in variable paths
// Spaces, dots, and brackets would break the dot-notation parsing
const SPECIAL_CHARS_REGEX = /[\s.[]/;
const SPECIAL_CHARS_REGEX = /[\s[]/;
export const needsEscaping = (key: string): boolean =>
SPECIAL_CHARS_REGEX.test(key);