Skip to content

Commit

Permalink
fix(targetchange): do not geenrate HTML for simple text fields
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jul 30, 2020
1 parent f6e09f0 commit 2d7a5f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion inc/fields/textareafield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ public function parseAnswerValues($input, $nonDestructive = false) {
}

public function getValueForTargetText($richText) {
return $this->value;
$value = $this->value;
if (!$richText) {
$value = Toolbox::unclean_cross_side_scripting_deep($value);
$value = strip_tags($value);
}
return $value;
}

public function equals($value) {
Expand Down
4 changes: 2 additions & 2 deletions inc/targetchange.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,10 @@ public function save(PluginFormcreatorFormAnswer $formanswer) {
$data[$changeField] = $this->prepareTemplate(
$this->fields[$changeField],
$formanswer,
true
$changeField == 'content' // only content supports rich text
);

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

$data['_users_id_recipient'] = $_SESSION['glpiID'];
Expand Down

0 comments on commit 2d7a5f6

Please sign in to comment.