Skip to content

Commit

Permalink
Merge branch 'pu/ccheng/rt_247850' into '2024.11'
Browse files Browse the repository at this point in the history
fix(Felamimail/Message): detech strict encoding from msg message

See merge request tine20/tine20!6654
  • Loading branch information
pschuele committed Feb 27, 2025
2 parents 5aebf52 + d2ed7fc commit 1196741
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions tests/tine20/Felamimail/Frontend/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2867,9 +2867,7 @@ public function testGetMessageFromNodeMsg()
dirname(__FILE__) . '/../files/multipart_related_recipients.msg'
);

// TODO make encodingCheck work again (in PHP 8.3+)
$encodingCheck = PHP_VERSION_ID < 80300;
$message = $this->_assertMessageFromNode($result[0]['id'], $encodingCheck);
$message = $this->_assertMessageFromNode($result[0]['id'], true);
self::assertEquals(2, count($message['cc']));
self::assertEquals('[email protected]', $message['cc'][0]['email']);
self::assertEquals('[email protected]', $message['cc'][1]['email']);
Expand Down
4 changes: 2 additions & 2 deletions tine20/Felamimail/Controller/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -1502,8 +1502,8 @@ public function getMessageFromNode($nodeId, $mimeType = null): Felamimail_Model_
}

if ($message['body_content_type'] === 'text/html') {
$encoding = mb_detect_encoding($message['body']);
if (! $encoding) {
$encoding = mb_detect_encoding($message['body'], 'UTF-8', true);
if (!$encoding) {
$message['body'] = mb_convert_encoding($message['body'], 'UTF-8', 'ISO-8859-1');
}
$message->body = str_replace("\r", '', $message['body']);
Expand Down

0 comments on commit 1196741

Please sign in to comment.