* Mail: fix forwarding and reply to mail with just a PDF or image was showing it and not opening a compose window

This commit is contained in:
ralf 2024-03-20 12:51:39 +02:00
parent 76793ac1b7
commit 2ed34a39c6
2 changed files with 9 additions and 9 deletions

View File

@ -4961,9 +4961,11 @@ class Mail
* @param boolean $_preserveSeen flag to preserve the seenflag by using body.peek
* @param string $_folder folder to work on
* @param Horde_Mime_part& $calendar_part =null on return calendar-part or null, if there is none
* @param bool $output_no_body true: if we have no "real" body, but a PDF or image, output it to display, false: return empty body
* @return array containing the message body, mimeType and charset
*/
function getMessageBody($_uid, $_htmlOptions='', $_partID=null, Horde_Mime_Part $_structure=null, $_preserveSeen = false, $_folder = '', &$calendar_part=null)
function getMessageBody($_uid, $_htmlOptions='', $_partID=null, Horde_Mime_Part $_structure=null, $_preserveSeen = false,
$_folder = '', &$calendar_part=null, bool $output_no_body=true)
{
if (self::$debug) echo __METHOD__."$_uid, $_htmlOptions, $_partID<br>";
if($_htmlOptions != '') {
@ -5001,7 +5003,7 @@ class Mail
}
// if message is just a pdf, return it to browser to display
if ($_structure->getType() === 'application/pdf' || $_structure->getPrimaryType() === 'image')
if ($output_no_body && ($_structure->getType() === 'application/pdf' || $_structure->getPrimaryType() === 'image'))
{
header('Content-Type: '.$_structure->getType());
echo $this->getAttachment($_uid, $_partID ?? '1', 0, true, $_folder)->getContents();

View File

@ -326,7 +326,7 @@ class mail_compose
$_contentHasSigID = $_content?array_key_exists('mailidentity',(array)$_content):false;
$_contentHasMimeType = $_content? array_key_exists('mimeType',(array)$_content):false;
// fetch appendix data which is an assistance input value consisiting of json data
// fetch appendix data which is an assistance input value consisting of json data
if (!empty($_content['appendix_data']))
{
$appendix_data = json_decode($_content['appendix_data'], true);
@ -2283,7 +2283,8 @@ class mail_compose
//_debug_array($headers);
//error_log(__METHOD__.__LINE__.'->'.array2string($this->mailPreferences['htmlOptions']));
try {
$bodyParts = $mail_bo->getMessageBody($_uid, ($this->mailPreferences['htmlOptions']?$this->mailPreferences['htmlOptions']:''), $_partID);
$bodyParts = $mail_bo->getMessageBody($_uid, $this->mailPreferences['htmlOptions']??'', $_partID,
null, false, '', $nul, false);
}
catch (Mail\Smime\PassphraseMissing $e)
{
@ -2374,11 +2375,8 @@ class mail_compose
$this->sessionData['body'] .= "\r\n";
$hasSignature = false;
// create body new, with good line breaks and indention
foreach(explode("\n",$newBody) as $value) {
// the explode is removing the character
//$value .= 'ee';
// Try to remove signatures from qouted parts to avoid multiple
foreach($newBody ? explode("\n",$newBody) : [] as $value) {
// Try to remove signatures from quoted parts to avoid multiple
// signatures problem in reply (rfc3676#section-4.3).
if ($_mode != 'forward' && ($hasSignature || ($hasSignature = preg_match("/^--\s[\r\n]$/",$value))))
{