mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-24 22:25:09 +03:00
MailSo: a folded plain-text line no longer leaves two spaces
Unfolding appended a newline before the continuation line, which kept its
own leading whitespace; Header turns the newline into a space, so every
fold became two spaces ("et checklist"), carried into reply subjects.
The test now compares exactly.
This commit is contained in:
parent
37fcdbe534
commit
7c432e392b
2 changed files with 5 additions and 6 deletions
|
|
@ -136,14 +136,12 @@ class HeaderCollection extends \MailSo\Base\Collection
|
|||
$sHeadersValue = \rtrim($sHeadersValue);
|
||||
}
|
||||
|
||||
// RFC 2047 6.2: only whitespace between two encoded words is
|
||||
// dropped; after a plain word the folding space is a real space.
|
||||
// RFC 5322 unfolding removes the line break and keeps the folding
|
||||
// whitespace; RFC 2047 6.2 drops it only between two encoded words.
|
||||
if ('=?' === \substr(\ltrim($sHeadersValue), 0, 2) && '?=' === \substr($sValue, -2)) {
|
||||
$sValue .= \ltrim($sHeadersValue);
|
||||
} else if ('=?' === \substr(\ltrim($sHeadersValue), 0, 2)) {
|
||||
$sValue .= ' '.\ltrim($sHeadersValue);
|
||||
} else {
|
||||
$sValue .= "\n".$sHeadersValue;
|
||||
$sValue .= ' '.\ltrim($sHeadersValue);
|
||||
}
|
||||
} else {
|
||||
if (null !== $sName) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ $cases = [
|
|||
"Hello\r\n world" => 'Hello world',
|
||||
];
|
||||
foreach ($cases as $raw => $want) {
|
||||
$got = preg_replace('/\s+/', ' ', subject($raw));
|
||||
// exact: a fold is one space, never two ("et checklist" ended up in replies)
|
||||
$got = subject($raw);
|
||||
check($got === $want, "got [{$got}], want [{$want}]");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue