mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
* Mail: do not stall (quick-)preview on mails without text-part e.g. PDF only
This commit is contained in:
parent
864bd19040
commit
da6a397e3f
@ -1706,6 +1706,7 @@ class Mail
|
|||||||
((intval($mime_id) === 1) || !$mime_id) &&
|
((intval($mime_id) === 1) || !$mime_id) &&
|
||||||
($partdisposition !== 'attachment')) {
|
($partdisposition !== 'attachment')) {
|
||||||
$_structure=$part;
|
$_structure=$part;
|
||||||
|
try {
|
||||||
$this->fetchPartContents($uid, $_structure, false,true);
|
$this->fetchPartContents($uid, $_structure, false,true);
|
||||||
$headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(Mail\Html::convertHTMLToText($_structure->getContents()),0,((int)$_fetchPreviews<300?300:$_fetchPreviews))));
|
$headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(Mail\Html::convertHTMLToText($_structure->getContents()),0,((int)$_fetchPreviews<300?300:$_fetchPreviews))));
|
||||||
$charSet = $part->getCharset();
|
$charSet = $part->getCharset();
|
||||||
@ -1719,6 +1720,10 @@ class Mail
|
|||||||
$headerObject['BODYPREVIEW'] = Translation::convert_jsonsafe($headerObject['BODYPREVIEW'], $charSet);
|
$headerObject['BODYPREVIEW'] = Translation::convert_jsonsafe($headerObject['BODYPREVIEW'], $charSet);
|
||||||
//error_log(__METHOD__.__LINE__.$headerObject['BODYPREVIEW']);
|
//error_log(__METHOD__.__LINE__.$headerObject['BODYPREVIEW']);
|
||||||
}
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
// mail probably has no text-part
|
||||||
|
}
|
||||||
|
}
|
||||||
//error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.'->'.$mime_id.' Disp:'.$partdisposition.' Type:'.$partPrimaryType);
|
//error_log(__METHOD__.' ('.__LINE__.') '.' Uid:'.$uid.'->'.$mime_id.' Disp:'.$partdisposition.' Type:'.$partPrimaryType);
|
||||||
$cid = $part->getContentId();
|
$cid = $part->getContentId();
|
||||||
if (empty($partdisposition) && $partPrimaryType != 'multipart' && $partPrimaryType != 'text')
|
if (empty($partdisposition) && $partPrimaryType != 'multipart' && $partPrimaryType != 'text')
|
||||||
@ -4890,9 +4895,14 @@ class Mail
|
|||||||
if (empty($partToReturn)&&$_tryDecodingServerside===true)
|
if (empty($partToReturn)&&$_tryDecodingServerside===true)
|
||||||
{
|
{
|
||||||
error_log(__METHOD__.__LINE__.' failed to fetch bodyPart in BINARY. Try BODY');
|
error_log(__METHOD__.__LINE__.' failed to fetch bodyPart in BINARY. Try BODY');
|
||||||
|
try {
|
||||||
$partToReturn = $this->getBodyPart($_uid, $_partID, $_folder, $_preserveSeen, $_stream, $_encoding, false);
|
$partToReturn = $this->getBodyPart($_uid, $_partID, $_folder, $_preserveSeen, $_stream, $_encoding, false);
|
||||||
}
|
}
|
||||||
return ($partToReturn?$partToReturn:null);
|
catch(\Exception $e) {
|
||||||
|
// mail probably has no text-body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $partToReturn ?: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4935,6 +4945,7 @@ class Mail
|
|||||||
// RB: not sure what this is: preg_replace('/PropertyFile___$/','',$this->decodeMimePart($mimePartBody, $_structure->encoding, $this->getMimePartCharset($_structure))),
|
// RB: not sure what this is: preg_replace('/PropertyFile___$/','',$this->decodeMimePart($mimePartBody, $_structure->encoding, $this->getMimePartCharset($_structure))),
|
||||||
|
|
||||||
// Should not try to fetch if the content is already there (e.g. Smime encrypted message)
|
// Should not try to fetch if the content is already there (e.g. Smime encrypted message)
|
||||||
|
try {
|
||||||
if (empty($_structure->getContents())) $this->fetchPartContents($_uid, $_structure, $_stream, $_preserveSeen);
|
if (empty($_structure->getContents())) $this->fetchPartContents($_uid, $_structure, $_stream, $_preserveSeen);
|
||||||
|
|
||||||
$bodyPart = array(
|
$bodyPart = array(
|
||||||
@ -4945,6 +4956,15 @@ class Mail
|
|||||||
'charSet' => $_structure->getCharset(),
|
'charSet' => $_structure->getCharset(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
$bodyPart = array(
|
||||||
|
'error' => 1,
|
||||||
|
'body' => lang('Mail probably has no text-body').":\n\n".$e->getMessage(),
|
||||||
|
'mimeType' => 'text/plain', // make sure we do not return mimeType text/html
|
||||||
|
'charSet' => self::$displayCharset,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $bodyPart;
|
return $bodyPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,6 +344,7 @@ mail common de E-Mail
|
|||||||
mail acl mail de Zugriffsrechte
|
mail acl mail de Zugriffsrechte
|
||||||
mail filter mail de Filter
|
mail filter mail de Filter
|
||||||
mail filter rule mail de Filter-Regel
|
mail filter rule mail de Filter-Regel
|
||||||
|
mail probably has no text-body mail de Die Mail hat vermutlich keinen Textteil
|
||||||
mail settings mail de E-Mail-Einstellungen
|
mail settings mail de E-Mail-Einstellungen
|
||||||
mail source mail de Nachrichten-Quelltext anzeigen
|
mail source mail de Nachrichten-Quelltext anzeigen
|
||||||
mail-address mail de E-Mail-Adresse
|
mail-address mail de E-Mail-Adresse
|
||||||
|
@ -344,6 +344,7 @@ mail common en Mail
|
|||||||
mail acl mail en Email access rights
|
mail acl mail en Email access rights
|
||||||
mail filter mail en Filter
|
mail filter mail en Filter
|
||||||
mail filter rule mail en Mail filter rule
|
mail filter rule mail en Mail filter rule
|
||||||
|
mail probably has no text-body mail en Mail probably has no text-body
|
||||||
mail settings mail en Mail settings
|
mail settings mail en Mail settings
|
||||||
mail source mail en Mail Source
|
mail source mail en Mail Source
|
||||||
mail-address mail en Mail-Address
|
mail-address mail en Mail-Address
|
||||||
|
Loading…
Reference in New Issue
Block a user