Skip to content

[15.0][FIX] mail: handle nested braces in jinja placeholders - #6063

Open
SamyShaawat wants to merge 1 commit into
OCA:15.0from
SamyShaawat:15.0-fix-mail-jinja-nested-braces
Open

SamyShaawat wants to merge 1 commit into
OCA:15.0from
SamyShaawat:15.0-fix-mail-jinja-nested-braces

Conversation

@SamyShaawat

Copy link
Copy Markdown

Fixes #5480

The ${...} placeholders were converted with \$\{([^}]*)\}, which stops at the first }. An expression with a dict literal like ${object.env["dummy.model"].create({"val": value}).name} became <t t-out='object.env["dummy.model"].create({"val": value'></t>).name}.

Both the char and the html conversions now use a small helper that finds the matching closing brace by counting braces and skipping quoted strings. A placeholder that is never closed is left as it was.

I checked it with the example from the issue, plain placeholders, a } inside a string and an unclosed placeholder. I did not run a full 14.0 -> 15.0 migration.

The regex used to convert ${...} placeholders stopped at the first closing brace, so an expression like ${create({"a": b}).name} was cut in the middle. Find the closing brace by balancing the braces and skipping quoted strings instead.
@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:15.0 labels Oct 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_scripts Module openupgrade_scripts series:15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants