Skip to content

Commit 1b71d65

Browse files
committed
fix(textfield): target ticket title need html encoding
GLPI 10.0.7 HTML encodes data in ticket's title
1 parent 8aaec8a commit 1b71d65

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

inc/field/textfield.class.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ public function getValueForDesign(): string {
108108
}
109109

110110
public function getValueForTargetText($domain, $richText): ?string {
111-
if ($richText) {
112-
return Sanitizer::encodeHtmlSpecialChars($this->value);
113-
}
114-
115-
return $this->value;
111+
return Sanitizer::encodeHtmlSpecialChars($this->value);
116112
}
117113

118114
public function moveUploads() {

tests/3-unit/GlpiPlugin/Formcreator/Field/TextField.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function providerGetValueForTargetText() {
401401
'question' => $this->getQuestion(),
402402
'value' => '"><img src=x onerror="alert(1337)" x=x>',
403403
'expected' => true,
404-
'expectedValue' => '"><img src=x onerror="alert(1337)" x=x>',
404+
'expectedValue' => '"&#62;&#60;img src=x onerror="alert(1337)" x=x&#62;',
405405
],
406406
];
407407
}

0 commit comments

Comments
 (0)