Skip to content

UI: move escaping in charts from consumers to renderer (46966)#11119

Merged
thibsy merged 2 commits intoILIAS-eLearning:release_10from
schmitz-ilias:bt-46966
Feb 26, 2026
Merged

UI: move escaping in charts from consumers to renderer (46966)#11119
thibsy merged 2 commits intoILIAS-eLearning:release_10from
schmitz-ilias:bt-46966

Conversation

@schmitz-ilias
Copy link
Contributor

This PR fixes 46966 by escaping the content of KS charts directly before rendering it, instead of leaving it to consumers to escape the data themselves. This is necessary, because the same data is used for two different purposes, with two different requirements for escaping: once to a screen-reader-only listing rendered as HTML, and once passed as JSON to chart.js.

Let me know if you want anything done differently!

@schmitz-ilias schmitz-ilias added bugfix kitchen sink php Pull requests that update Php code labels Feb 13, 2026
Copy link
Contributor

@thibsy thibsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @schmitz-ilias,

Thx a lot for the bugfix! The approach seems plausible to me. In addition, could you

Please implement the following changes:

  • Unit test: please provide at least one rendering unit test which ensures the values are properly encoded, maybe use a data-provider for multiple.

Kind regards,
@thibsy (as UI coordinator)

@schmitz-ilias
Copy link
Contributor Author

Done! For what it's worth, I think escaping in AbstractComponentRenderer::convertSpecialCharacters should be tested once centrally, and then mocked out when testing the actual implemented renderers. This would however have required a bit more refactoring of the tests than I had time for.

Copy link
Contributor

@thibsy thibsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @schmitz-ilias,

Thx a lot for the unit tests, very well structured!

I agree with what you are saying about the escaping unit tests. Since we do band-aid escaping, I think its fine if we also do band-aid testing for now =).

Kind regards,
@thibsy (as UI coordinator)

@thibsy thibsy merged commit 9c784c0 into ILIAS-eLearning:release_10 Feb 26, 2026
3 checks passed
thibsy pushed a commit that referenced this pull request Feb 26, 2026
thibsy pushed a commit that referenced this pull request Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix kitchen sink php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants