Skip to content

Commit 2d7a5f6

Browse files
committed
fix(targetchange): do not geenrate HTML for simple text fields
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent f6e09f0 commit 2d7a5f6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

inc/fields/textareafield.class.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ public function parseAnswerValues($input, $nonDestructive = false) {
184184
}
185185

186186
public function getValueForTargetText($richText) {
187-
return $this->value;
187+
$value = $this->value;
188+
if (!$richText) {
189+
$value = Toolbox::unclean_cross_side_scripting_deep($value);
190+
$value = strip_tags($value);
191+
}
192+
return $value;
188193
}
189194

190195
public function equals($value) {

inc/targetchange.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,10 @@ public function save(PluginFormcreatorFormAnswer $formanswer) {
608608
$data[$changeField] = $this->prepareTemplate(
609609
$this->fields[$changeField],
610610
$formanswer,
611-
true
611+
$changeField == 'content' // only content supports rich text
612612
);
613613

614-
$data[$changeField] = $formanswer->parseTags($data[$changeField], $this);
614+
$data[$changeField] = $formanswer->parseTags($data[$changeField], $this, $changeField == 'content');
615615
}
616616

617617
$data['_users_id_recipient'] = $_SESSION['glpiID'];

0 commit comments

Comments
 (0)