Enable EscapeNonASCIICharacters option only for outgoing replies - closes #5481
This commit is contained in:
@@ -298,7 +298,7 @@ class Thread extends Model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCleanBody($body = '')
|
||||
public function getCleanBody($body = '', $escape_non_ascii_characters = false)
|
||||
{
|
||||
if (!$body) {
|
||||
$body = $this->body;
|
||||
@@ -333,7 +333,19 @@ class Thread extends Model
|
||||
// Remove <!--[if !mso]><!--> and <!--<![endif]--> comments, preserving the data inside
|
||||
//$body = preg_replace('/(<!\-\-\[if [^>]+\]>|<!\[endif\]\-\->)/', '', $body);
|
||||
|
||||
return \Helper::purifyHtml($body);
|
||||
// This option causes issues on some instances:
|
||||
// https://github.com/freescout-help-desk/freescout/issues/5481#issuecomment-5113750894
|
||||
if ($escape_non_ascii_characters) {
|
||||
\Config::set('purifier.settings.default.Core.EscapeNonASCIICharacters', true);
|
||||
}
|
||||
|
||||
$body = \Helper::purifyHtml($body);
|
||||
|
||||
if ($escape_non_ascii_characters) {
|
||||
\Config::set('purifier.settings.default.Core.EscapeNonASCIICharacters', false);
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,8 +23,9 @@ return [
|
||||
'cacheFileMode' => 0755,
|
||||
'settings' => [
|
||||
'default' => [
|
||||
// https://github.com/freescout-help-desk/freescout/issues/5481
|
||||
'Core.EscapeNonASCIICharacters' => true,
|
||||
// Enabling this EscapeNonASCIICharacters option permanently causes issues:
|
||||
// https://github.com/freescout-help-desk/freescout/issues/5481#issuecomment-5113750894
|
||||
//'Core.EscapeNonASCIICharacters' => true,
|
||||
'HTML.Doctype' => 'HTML 4.01 Transitional',
|
||||
'HTML.Allowed' => 'div[style],b,strong,i,em,u,a[href|title|style],ul,ol,li,p[style],br,span[style],img[width|height|alt|src|style],table[style|border|bgcolor|cellspacing|cellpadding|border|width|class],tr[style|bgcolor],td[style|colspan|rowspan|width|bgcolor|border|valign|align],th[style|colspan|rowspan],thead,tfoot,tbody,blockquote,pre,s,strike,font[style|color],h1[style],h2[style],h3[style],h4[style],h5[style],h6,center',
|
||||
'CSS.AllowedProperties' => 'display,overflow,border-radius,letter-spacing,white-space,font-size,margin,margin-top,margin-right,margin-bottom,margin-left,background,text-transform,max-width,max-height,width,height,font,padding,padding-top,padding-right,padding-bottom,padding-left,font-family,border-color,font-weight,font-style,text-decoration,color,background-color,text-align,border,border-top,border-left,border-bottom,border-right',
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
@if ($thread->source_via == App\Thread::PERSON_USER && $mailbox->before_reply && $loop->first)
|
||||
<span style="color:#b5b5b5">{{ $mailbox->before_reply }}</span><br><br>
|
||||
@endif
|
||||
{!! $thread->getCleanBody() !!}
|
||||
{!! $thread->getCleanBody('', true) !!}
|
||||
|
||||
@action('reply_email.before_signature', $thread, $loop, $threads, $conversation, $mailbox, $threads_count)
|
||||
@if ($thread->source_via == App\Thread::PERSON_USER && \Eventy::filter('reply_email.include_signature', true, $thread))
|
||||
|
||||
Reference in New Issue
Block a user