Skip to content

templates: an authored field label: is written raw into the Harmonia report JS and the form T() fallback - an apostrophe blanks the page (#7207 class) #7294

Description

@delchev

Describe the bug

Same defect class as #7205 / #7206 / #7207 (an authored string written verbatim into a generated literal), fourth free-text key: the field label: (#6424). EdmIntentGenerator puts it on the property as widgetLabel unchanged (edm/EdmIntentGenerator.java:1222), the parser only refuses a blank label (IntentParser.validateLabels, :5395), and the Harmonia templates interpolate it raw:

ui/perspective/report/table-page.js.template:63   label: #if($property.widgetLabel)'${property.widgetLabel}'#else'${property.name}'#end
ui/perspective/report/chart-page.js.template:40   { name: #if($property.widgetLabel)'${property.widgetLabel}'#else ...
ui/perspective/manage/form-view.html.template:119 #set($label = $property.widgetLabel) ... :130  x-text="T('$projectName:${tprefix}.t.${property.dataName}', '${label}')"
ui/perspective/document/document-view.html.template:101/352/594  same #set($label/$alabel/$rolabel = $property.widgetLabel)

label: "Owner's copy" (or Customer's ref, "Qty (pcs)" is fine, Note's is not) closes the single-quoted JS literal: the report page's column list is a syntax error and the whole page is blank; in the form view the apostrophe ends the T() fallback argument inside an Alpine x-text expression, which throws at evaluation and - per the harmonia-ui guide - aborts the walk of the enclosing element. The guide already records this exact rule for task-form labels ("an authored label must be escaped where it is interpolated into a T() call - both the literal and the key"); the entity views never got it.

JsLiterals.escape exists since #7255 for the item-dialog seed and is the helper to route these through.

Expected

Every ${property.widgetLabel} / ${label} interpolation into a JS string or an Alpine expression in the Harmonia templates goes through the JS escape (a widgetLabelJs resolved once in ModelParameterProcessor, as widgetPatternJava / dataDefaultValueJs are), and IntentEmissionCoverageIT's fixture declares a label with an apostrophe so the generated pages are compiled/loaded with it.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions