mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user