Korjaa sähköpostivastausten välilyönnit: nl2br + pre-wrap:n sijaan
white-space:pre-wrap ei toimi kaikissa sähköpostiohjelmissa/Zammadissa. Vaihdettu käyttämään nl2br() rivinvaihdoille ja peräkkäisille välilyönneille, jotka toimivat universaalisti HTML-sähköposteissa. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
8
api.php
8
api.php
@@ -5411,7 +5411,9 @@ switch ($action) {
|
||||
$cc = !empty($input['cc']) ? trim($input['cc']) : '';
|
||||
|
||||
// Muunna uusi viesti HTML:ksi (säilytä rivinvaihdot ja välilyönnit)
|
||||
$newMsgHtml = '<div style="white-space:pre-wrap;">' . htmlspecialchars($body, ENT_QUOTES, 'UTF-8') . '</div>';
|
||||
$escaped = htmlspecialchars($body, ENT_QUOTES, 'UTF-8');
|
||||
$escaped = preg_replace('/ /', ' ', $escaped); // säilytä peräkkäiset välilyönnit
|
||||
$newMsgHtml = nl2br($escaped);
|
||||
|
||||
// Rakenna viestiketju (quoted thread) vastaukseen
|
||||
$messages = _dbFetchAll(
|
||||
@@ -5425,7 +5427,9 @@ switch ($action) {
|
||||
$msgBody = $msg['body'] ?: '';
|
||||
// Jos viesti on plain text (ei HTML-tageja), muunna HTML:ksi
|
||||
if ($msgBody !== '' && strip_tags($msgBody) === $msgBody) {
|
||||
$msgBody = '<div style="white-space:pre-wrap;">' . htmlspecialchars($msgBody, ENT_QUOTES, 'UTF-8') . '</div>';
|
||||
$esc = htmlspecialchars($msgBody, ENT_QUOTES, 'UTF-8');
|
||||
$esc = preg_replace('/ /', ' ', $esc);
|
||||
$msgBody = nl2br($esc);
|
||||
}
|
||||
$quotedThread .= '<br><div style="padding-left:0.5em;border-left:2px solid #ccc;color:#555;">'
|
||||
. '<small><strong>' . htmlspecialchars($sender) . '</strong> — ' . $date . '</small><br>'
|
||||
|
||||
Reference in New Issue
Block a user