Commit 9015daf4 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1240 HTML safe truncate streams containing HTML data.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 5cc71129
......@@ -2437,11 +2437,13 @@ class MAPIProvider {
* @return boolean
*/
private function setMessageBodyForType($mapimessage, $bpReturnType, &$message) {
$truncateHtmlSafe = false;
//default value is PR_BODY
$property = PR_BODY;
switch ($bpReturnType) {
case SYNC_BODYPREFERENCE_HTML:
$property = PR_HTML;
$truncateHtmlSafe = true;
break;
case SYNC_BODYPREFERENCE_RTF:
$property = PR_RTF_COMPRESSED;
......@@ -2473,11 +2475,11 @@ class MAPIProvider {
elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) {
// if PR_HTML is UTF-8 we can stream it directly, else we have to convert to UTF-8 & wrap it
if (Utils::GetCodepageCharset($message->internetcpid) == "utf-8") {
$message->asbody->data = MAPIStreamWrapper::Open($stream);
$message->asbody->data = MAPIStreamWrapper::Open($stream, $truncateHtmlSafe);
}
else {
$body = $this->mapiReadStream($stream, $streamsize);
$message->asbody->data = StringStreamWrapper::Open(Utils::ConvertCodepageStringToUtf8($message->internetcpid, $body));
$message->asbody->data = StringStreamWrapper::Open(Utils::ConvertCodepageStringToUtf8($message->internetcpid, $body), $truncateHtmlSafe);
$message->internetcpid = INTERNET_CPID_UTF8;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment