diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php index 624f2beb8..65edee844 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php @@ -337,6 +337,26 @@ class BodyStructure return $aReturn; } + /** + * @return \MailSo\Imap\BodyStructure|null + */ + public function SearchInlineEncryptedPart() + { + if ('multipart/encrypted' === \strtolower($this->ContentType())) + { + $aSearchParts = $this->SearchByCallback(function ($oItem) { + return $oItem->IsInline(); + }); + + if (is_array($aSearchParts) && 1 === \count($aSearchParts) && isset($aSearchParts[0])) + { + return $aSearchParts[0]; + } + } + + return null; + } + /** * @return array|null */ @@ -348,6 +368,15 @@ class BodyStructure $mResult = $this->SearchPlainParts(); } + if (null === $mResult || (\is_array($mResult) && 0 === count($mResult))) + { + $oPart = $this->SearchInlineEncryptedPart(); + if ($oPart instanceof \MailSo\Imap\BodyStructure) + { + $mResult = array($oPart); + } + } + return $mResult; } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 738b0ce35..b8836e9ad 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -9592,8 +9592,8 @@ class Actions }; } - $sHtml = \preg_replace_callback('/
]*>([\s\S\r\n\t]*)<\/pre>/mi', function ($aMatches) {
- return \preg_replace('/[\r\n]+/', '
', $aMatches[0]);
+ $sHtml = \preg_replace_callback('/(]*>)([\s\S\r\n\t]*?)(<\/pre>)/mi', function ($aMatches) {
+ return \preg_replace('/[\r\n]+/', '
', $aMatches[1].\trim($aMatches[2]).$aMatches[3]);
}, $sHtml);
$mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml(