You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Mridul Pathak (Jira)" <ji...@apache.org> on 2026/10/06 13:30:00 UTC

[jira] [Created] (OFBIZ-13649) Escape backslash and braces in the FreeMarker macro strings built by the macro menu, tree and form renderers

Mridul Pathak created OFBIZ-13649:
-------------------------------------

             Summary: Escape backslash and braces in the FreeMarker macro strings built by the macro menu, tree and form renderers
                 Key: OFBIZ-13649
                 URL: https://issues.apache.org/jira/browse/OFBIZ-13649
             Project: OFBiz
          Issue Type: Bug
          Components: framework/widget
    Affects Versions: 24.09.07, Upcoming Branch
            Reporter: Mridul Pathak
            Assignee: Mridul Pathak


MacroMenuRenderer.executeMacro(Appendable, String, Map), MacroTreeRenderer (imgStr) and MacroFormRenderer (encodeDoubleQuotes) build parts of a macro call as template text and only escape the double quote of the value. Backslashes and the FreeMarker interpolation characters are left as they are, so a value containing them is interpreted by FreeMarker instead of being rendered literally (or fails to parse). MacroScreenRenderer.executeMacro already escapes backslash, double quote and the opening brace.

h3. Proposed change

Add one shared helper that escapes a value for a double-quoted FreeMarker string literal (backslash, double quote, opening brace), use it in MacroScreenRenderer and in the three places above in place of the quote-only escaping, and add unit tests that render values containing backslashes, quotes, ${...}, #{...} and braces and check that they come back literally. Existing widget output must stay the same for normal text.

h3. Scope and risk

Only the existing quote-only escapes are replaced. The values that MacroTreeRenderer and MacroFormRenderer append without any escaping are not changed here; they are part of the broader work on keeping user data out of macro template text (OFBIZ-11456). A value that today relies on being evaluated as a FreeMarker expression in one of these strings would now be rendered literally, so the widget tests and a manual check of menus, trees and forms are needed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)