Do not strip tags when markdown is in use. (#11075)

Markdown supports limited HTML tags, which can help enrich messages.
Additionally, eliminate extra whitespace when markdown is used as that
will have weird output effects.
This commit is contained in:
Joe Clarke
2020-01-29 06:59:23 -05:00
committed by GitHub
parent 3f53eed245
commit 0a34322877

View File

@ -29,14 +29,28 @@ class Ciscospark extends Transport
public function contactCiscospark($obj, $room_id, $token)
{
$text = strip_tags($obj['msg']);
$text = null;
$data = array (
'roomId' => $room_id
);
$akey = 'text';
if ($this->config['use-markdown'] === 'on') {
$lines = explode("\n", $obj['msg']);
$mlines = [];
/* Remove blank lines as they create weird markdown
* behaviors.
*/
foreach ($lines as $line) {
$line = trim($line);
if ($line != '') {
array_push($mlines, $line);
}
}
$text = implode("\n", $mlines);
$akey = 'markdown';
} else {
$text = strip_tags($obj['msg']);
}
$data[$akey] = $text;