Bugfix: ETag should use account not ImapClient as switching accounts could generate same hash

This commit is contained in:
the-djmaze 2023-03-07 11:41:47 +01:00
parent e2ed87a1ab
commit 402de0d569
3 changed files with 4 additions and 4 deletions

View file

@ -163,7 +163,7 @@ class Folder implements \JsonSerializable
'totalEmails' => (int) $this->MESSAGES,
'unreadEmails' => (int) $this->UNSEEN,
'uidNext' => (int) $this->UIDNEXT,
// 'etag' => $this->ETag($this->ImapClient()->Hash())
// 'etag' => $this->ETag($this->getAccountFromToken()->IncLogin())
);
}
*/

View file

@ -65,7 +65,7 @@ trait Messages
// $oInfo = $this->MailClient()->FolderHash($oParams->sFolderName);
$oInfo = $this->ImapClient()->FolderStatusAndSelect($oParams->sFolderName);
$aRequestHash = \explode('-', $sHash);
$sFolderHash = $oInfo->getETag($this->ImapClient()->Hash());
$sFolderHash = $oInfo->getETag($this->getAccountFromToken()->IncLogin());
$sHash = $oParams->hash() . '-' . $sFolderHash;
if ($aRequestHash[1] == $sFolderHash) {
$this->verifyCacheByKey($sHash);
@ -429,7 +429,7 @@ trait Messages
}
if ($oMessage) {
$ETag = $oMessage->ETag($this->ImapClient()->Hash());
$ETag = $oMessage->ETag($this->getAccountFromToken()->IncLogin());
$this->verifyCacheByKey($ETag);
$this->Plugins()->RunHook('filter.result-message', array($oMessage));
$this->cacheByKey($ETag);

View file

@ -155,7 +155,7 @@ trait Response
if ($mResponse instanceof \MailSo\Imap\Folder) {
$aResult = $mResponse->jsonSerialize();
$sHash = $mResponse->ETag($this->ImapClient()->Hash());
$sHash = $mResponse->ETag($this->getAccountFromToken()->IncLogin());
if ($sHash) {
$aResult['etag'] = $sHash;
}