Repository navigation
Fix: do not strip special characters from labels - #1287
Open
AdamoLeKing wants to merge 3 commits into
Open
AdamoLeKing wants to merge 3 commits into
AdamoLeKing wants to merge 3 commits into
Conversation
stonebuzz
reviewed
Oct 7, 2026
stonebuzz
left a comment
Contributor
There was a problem hiding this comment.
Many fix about this, please add unit test
Bestr egards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since commit 999e1c1,
PluginFieldsToolbox::sanitizeLabel()is applied to everylabel written in
PluginFieldsLabelTranslationand to container labels.It strips every character that is not a letter, digit, space,
-,_or.,so a field labelled "N° d'inventaire / site" is displayed as "N dinventaire site".
Labels are plain data:
htmlspecialchars, Twig autoescape),var_export(), which is safefor any string.
System names (table, column, class and file names) are still restricted by
sanitizeSystemName()/getSystemNameFromLabel(), so the security fix is preserved.Changes
sanitizeLabel()on labels inPluginFieldsLabelTranslation,PluginFieldsToolbox::prepareLabel(),PluginFieldsContainerandPluginFieldsDropdown(labels are only trimmed).
nameandidsanitization is unchanged.Note
Labels already saved since 999e1c1 remain truncated in
glpi_plugin_fields_labeltranslationsandglpi_plugin_fields_containers.Field labels can be restored from
glpi_plugin_fields_fields.label; a migrationcould be added if maintainers want it.