mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Bugfix: application/pgp-encrypted attachments not listed
This commit is contained in:
parent
ed7a2bd239
commit
366ca05200
|
@ -172,9 +172,10 @@ class BodyStructure implements \JsonSerializable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IsAttachment() : bool
|
protected function IsAttachment(/*BodyStructure*/ $oParent) : bool
|
||||||
{
|
{
|
||||||
return 'application/pgp-encrypted' !== $this->sContentType
|
// return 'application/pgp-encrypted' !== $this->sContentType
|
||||||
|
return (!$oParent || !$oParent->isPgpEncrypted())
|
||||||
&& (
|
&& (
|
||||||
'attachment' === $this->sDisposition || (
|
'attachment' === $this->sDisposition || (
|
||||||
!\str_starts_with($this->sContentType, 'multipart/')
|
!\str_starts_with($this->sContentType, 'multipart/')
|
||||||
|
@ -194,8 +195,8 @@ class BodyStructure implements \JsonSerializable
|
||||||
{
|
{
|
||||||
$aParts = [];
|
$aParts = [];
|
||||||
|
|
||||||
$gParts = $this->SearchByCallback(function ($oItem) {
|
$gParts = $this->SearchByCallback(function ($oItem, $oParent) {
|
||||||
return $oItem->isText() && !$oItem->IsAttachment();
|
return $oItem->isText() && !$oItem->IsAttachment($oParent);
|
||||||
});
|
});
|
||||||
foreach ($gParts as $oPart) {
|
foreach ($gParts as $oPart) {
|
||||||
$aParts[] = $oPart;
|
$aParts[] = $oPart;
|
||||||
|
@ -232,13 +233,13 @@ class BodyStructure implements \JsonSerializable
|
||||||
|
|
||||||
public function SearchCharset() : string
|
public function SearchCharset() : string
|
||||||
{
|
{
|
||||||
$gParts = $this->SearchByCallback(function ($oPart) {
|
$gParts = $this->SearchByCallback(function ($oPart, $oParent) {
|
||||||
return $oPart->Charset() && $oPart->isText() && !$oPart->IsAttachment();
|
return $oPart->Charset() && $oPart->isText() && !$oPart->IsAttachment($oParent);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$gParts->valid()) {
|
if (!$gParts->valid()) {
|
||||||
$gParts = $this->SearchByCallback(function ($oPart) {
|
$gParts = $this->SearchByCallback(function ($oPart, $oParent) {
|
||||||
return $oPart->Charset() && $oPart->IsAttachment();
|
return $oPart->Charset() && $oPart->IsAttachment($oParent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +260,7 @@ class BodyStructure implements \JsonSerializable
|
||||||
{
|
{
|
||||||
return $this->SearchByCallback(function ($oItem, $oParent) {
|
return $this->SearchByCallback(function ($oItem, $oParent) {
|
||||||
// return $oItem->IsAttachment();
|
// return $oItem->IsAttachment();
|
||||||
return $oItem->IsAttachment() && (!$oParent || !$oParent->isPgpEncrypted());
|
return $oItem->IsAttachment($oParent) && (!$oParent || !$oParent->isPgpEncrypted());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue