Skip to content

XML special character in the context can result in corrupted DOCX #634

@keestux

Description

@keestux

Describe the bug

Special XML characters in "the context" can result in corrupted DOCX output.

To Reproduce

docx example would contain

{%p for  defect  in defects %}
Criticality: {{ defect.criticality }}
Source: {{ defect.source }}
{%p endfor %}

The context in json format

{
  "defects": [
    {
      "criticality": "<select>",
      "source": "QA"
    },
    {
      "criticality": "Safety Related",
      "source": "QA"
    }
  ]
}

No error is given during the template generation, but the .docx is corrupt. You can still open the .docx, but
the contents looks like this:

Criticality: 

Expected behavior

The generated .docx should be like this:

Safety Criticality: <select>
Source: QA

Safety Criticality: Safety Related
Source: QA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions