mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
fix no filename shown on save to disc for e.g. some message/rfc822 attachments
This commit is contained in:
parent
29f2bdf948
commit
a16125c2fe
@ -1388,6 +1388,7 @@ class felamimail_bo
|
||||
|
||||
if($_partID != 1) {
|
||||
foreach($imapPartIDs as $imapPartID) {
|
||||
$filename = '';
|
||||
if(!empty($tempID)) {
|
||||
$tempID .= '.';
|
||||
}
|
||||
@ -1402,7 +1403,14 @@ class felamimail_bo
|
||||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'RELATED' ||
|
||||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT'))
|
||||
{
|
||||
if (!isset($structure->subParts[$tempID]->subParts[$tempID]->filename) &&
|
||||
!isset($structure->subParts[$tempID]->subParts[$tempID]->parameters['NAME']) &&
|
||||
(isset($structure->subParts[$tempID]->filename) || isset($structure->subParts[$tempID]->parameters['NAME']))
|
||||
) {
|
||||
$filename = ($structure->subParts[$tempID]->filename&&$structure->subParts[$tempID]->filename!='NIL'?$structure->subParts[$tempID]->filename:($structure->subParts[$tempID]->parameters['NAME']?$structure->subParts[$tempID]->parameters['NAME']:''));
|
||||
}
|
||||
$structure = $structure->subParts[$tempID]->subParts[$tempID];
|
||||
if (!empty($filename)) $structure->filename=$filename;
|
||||
} else {
|
||||
$structure = $structure->subParts[$tempID];
|
||||
}
|
||||
@ -1411,6 +1419,7 @@ class felamimail_bo
|
||||
|
||||
if($structure->partID != $_partID) {
|
||||
foreach($imapPartIDs as $imapPartID) {
|
||||
$filename = '';
|
||||
if(!empty($tempID)) {
|
||||
$tempID .= '.';
|
||||
}
|
||||
@ -1423,8 +1432,16 @@ class felamimail_bo
|
||||
($structure->subParts[$tempID]->subParts[$tempID]->subType == 'MIXED' ||
|
||||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'ALTERNATIVE' ||
|
||||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'RELATED' ||
|
||||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT')) {
|
||||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT'))
|
||||
{
|
||||
if (!isset($structure->subParts[$tempID]->subParts[$tempID]->filename) &&
|
||||
!isset($structure->subParts[$tempID]->subParts[$tempID]->parameters['NAME']) &&
|
||||
(isset($structure->subParts[$tempID]->filename) || isset($structure->subParts[$tempID]->parameters['NAME']))
|
||||
) {
|
||||
$filename = ($structure->subParts[$tempID]->filename&&$structure->subParts[$tempID]->filename!='NIL'?$structure->subParts[$tempID]->filename:($structure->subParts[$tempID]->parameters['NAME']?$structure->subParts[$tempID]->parameters['NAME']:''));
|
||||
}
|
||||
$structure = $structure->subParts[$tempID]->subParts[$tempID];
|
||||
if (!empty($filename)) $structure->filename=$filename;
|
||||
} else {
|
||||
$structure = $structure->subParts[$tempID];
|
||||
}
|
||||
@ -1594,7 +1611,8 @@ class felamimail_bo
|
||||
{
|
||||
$attachment = translation::convert($attachment,$structure->parameters['CHARSET'],self::$displayCharset);
|
||||
}
|
||||
|
||||
$ext = mime_magic::mime2ext($structure->type .'/'. $structure->subType);
|
||||
if ($ext && stripos($filename,'.')===false && stripos($filename,$ext)===false) $filename = trim($filename).'.'.$ext;
|
||||
$attachmentData = array(
|
||||
'type' => $structure->type .'/'. $structure->subType,
|
||||
'filename' => $filename,
|
||||
@ -1606,6 +1624,8 @@ class felamimail_bo
|
||||
if ( $filename == 'winmail.dat' && $_winmail_nr > 0 &&
|
||||
( $wmattach = $this->decode_winmail( $_uid, $_partID, $_winmail_nr ) ) )
|
||||
{
|
||||
$ext = mime_magic::mime2ext($wmattach['type']);
|
||||
if ($ext && stripos($wmattach['name'],'.')===false && stripos($wmattach['name'],$ext)===false) $wmattach['name'] = trim($wmattach['name']).'.'.$ext;
|
||||
$attachmentData = array(
|
||||
'type' => $wmattach['type'],
|
||||
'filename' => $wmattach['name'],
|
||||
@ -3474,7 +3494,8 @@ class felamimail_bo
|
||||
//error_log(__METHOD__.__LINE__.array2string(substr($structure->parameters['NAME'],0,strlen('data:'))));
|
||||
if (!is_array($structure->parameters['NAME']) && substr($structure->parameters['NAME'],0,strlen('data:'))==='data:') {
|
||||
$namecounter++;
|
||||
return lang("unknown").$namecounter.($structure->subType ? ".".$structure->subType : "");
|
||||
$ext = mime_magic::mime2ext($structure->Type.'/'.$structure->subType);
|
||||
return lang("unknown").$namecounter.($ext?$ext:($structure->subType ? ".".$structure->subType : ""));
|
||||
}
|
||||
if (is_array($structure->parameters['NAME'])) $structure->parameters['NAME'] = implode(' ',$structure->parameters['NAME']);
|
||||
return rawurldecode(self::decode_header($structure->parameters['NAME']));
|
||||
@ -3524,7 +3545,8 @@ class felamimail_bo
|
||||
}
|
||||
}
|
||||
$namecounter++;
|
||||
return lang("unknown").$namecounter.($structure->subType ? ".".$structure->subType : "");
|
||||
$ext = mime_magic::mime2ext($structure->Type.'/'.$structure->subType);
|
||||
return lang("unknown").$namecounter.($ext?$ext:($structure->subType ? ".".$structure->subType : ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user