Skip to content
Snippets Groups Projects
Commit cfa84eab authored by Jared Hancock's avatar Jared Hancock
Browse files

Properly escape text bodies for canned responses

This patch changes the default formatting for text bodies used in emails,
ticket thread, and canned response quoting so that white-space in text
bodies is properly preserved. Previously, the text was treated as raw HTML
and was not properly escaped, nor was the original whitespace preserved.
parent 1e686f7d
No related branches found
No related tags found
No related merge requests found
......@@ -678,7 +678,7 @@ class TicketsAjaxAPI extends AjaxController {
Http::response(422, 'Unknown ticket variable');
// Ticket thread variables are assumed to be quotes
$response = "<br/><blockquote>$response</blockquote><br/>";
$response = "<br/><blockquote>{$response->asVar()}</blockquote><br/>";
// Return text if html thread is not enabled
if (!$cfg->isHtmlThreadEnabled())
......
......@@ -1412,10 +1412,9 @@ class TextThreadBody extends ThreadBody {
switch ($output) {
case 'html':
return '<div style="white-space:pre-wrap">'
.Format::clickableurls(Format::htmlchars($this->body)).'</div>';
case 'email':
return '<div style="white-space:pre-wrap">'.$this->body.'</div>';
return '<div style="white-space:pre-wrap">'
.Format::htmlchars($this->body).'</div>';
case 'pdf':
return nl2br($this->body);
default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment