Commit a329fcb1 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #355 in ZP/z-push from develop to release/2.3

* commit '6c1f546a':
  ZP-1028 Postinst fails leaving z-push-common unconfigured. Released under the Affero GNU General Public License (AGPL) version 3. do not fail whole script, if z-push-admin fails
  ZP-1025 Also filter https urls.
  ZP-1025 Remove all images and links from truncated plaintext emails.
parents 12674e7a 6c1f546a
......@@ -3,8 +3,6 @@
#
# see: dh_installdeb(1)
set -e
case "$1" in
configure)
/usr/local/sbin/z-push-admin -a fixstates
......
......@@ -2541,6 +2541,15 @@ class MAPIProvider {
$bpReturnType != SYNC_BODYPREFERENCE_MIME &&
$message->asbody->estimatedDataSize > $bpo->GetTruncationSize()
) {
// Truncated plaintext requests are used on iOS for the preview in the email list. All images and links should be removed - see https://jira.z-hub.io/browse/ZP-1025
if ($bpReturnType == SYNC_BODYPREFERENCE_PLAIN) {
ZLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->setMessageBody(): truncated plain-text body requested, stripping all links and images");
// Get more data because of the filtering it's most probably going down in size. It's going to be truncated to the correct size below.
$plainbody = stream_get_contents($message->asbody->data, $bpo->GetTruncationSize() * 3);
$message->asbody->data = StringStreamWrapper::Open(preg_replace('/<http(s){0,1}:\/\/.*?>/i', '', $plainbody));
}
// truncate data stream
ftruncate($message->asbody->data, $bpo->GetTruncationSize());
$message->asbody->truncated = 1;
......
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