Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2022-10-27 23:50:12 +0300
committerGitHub <noreply@github.com>2022-10-27 23:50:12 +0300
commit4092267c8435d20ad50477f9da8a7eafff1cd397 (patch)
treeda0c0d124e73fb84e3b45e8327f7d9319e5ef8e2
parent7b79f8352412693ad65b9e44ad15af9c08479b8a (diff)
parent8f8d48ccaf19c9d6efb3e8c3f7c224761a8101eb (diff)
Merge pull request #7486 from nextcloud/fix/transfer-encoding
Fix transfer encoding issue
-rw-r--r--lib/IMAP/MessageMapper.php7
-rw-r--r--lib/Migration/Version1140Date20221027171138.php57
2 files changed, 60 insertions, 4 deletions
diff --git a/lib/IMAP/MessageMapper.php b/lib/IMAP/MessageMapper.php
index b3a10bd57..546085056 100644
--- a/lib/IMAP/MessageMapper.php
+++ b/lib/IMAP/MessageMapper.php
@@ -700,8 +700,8 @@ class MessageMapper {
if ($textBodyId === null && $htmlBodyId === null) {
return new MessageStructureData($hasAttachments, $text, $isImipMessage);
}
+ $partsQuery = new Horde_Imap_Client_Fetch_Query();
if ($htmlBodyId !== null) {
- $partsQuery = new Horde_Imap_Client_Fetch_Query();
$partsQuery->bodyPart($htmlBodyId, [
'decode' => true,
'peek' => true,
@@ -711,7 +711,6 @@ class MessageMapper {
]);
}
if ($textBodyId !== null) {
- $partsQuery = new Horde_Imap_Client_Fetch_Query();
$partsQuery->bodyPart($textBodyId, [
'decode' => true,
'peek' => true,
@@ -727,7 +726,7 @@ class MessageMapper {
$part = $parts[$fetchData->getUid()];
$htmlBody = $part->getBodyPart($htmlBodyId);
if (!empty($htmlBody)) {
- $mimeHeaders = $fetchData->getMimeHeader($htmlBodyId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
+ $mimeHeaders = $part->getMimeHeader($htmlBodyId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
if ($enc = $mimeHeaders->getValue('content-transfer-encoding')) {
$structure->setTransferEncoding($enc);
}
@@ -737,7 +736,7 @@ class MessageMapper {
}
$textBody = $part->getBodyPart($textBodyId);
if (!empty($textBody)) {
- $mimeHeaders = $fetchData->getMimeHeader($textBodyId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
+ $mimeHeaders = $part->getMimeHeader($textBodyId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
if ($enc = $mimeHeaders->getValue('content-transfer-encoding')) {
$structure->setTransferEncoding($enc);
$structure->setContents($textBody);
diff --git a/lib/Migration/Version1140Date20221027171138.php b/lib/Migration/Version1140Date20221027171138.php
new file mode 100644
index 000000000..40f657541
--- /dev/null
+++ b/lib/Migration/Version1140Date20221027171138.php
@@ -0,0 +1,57 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2022 Anna Larch <anna.larch@gmx.net>
+ *
+ * @author Anna Larch <anna.larch@gmx.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Mail\Migration;
+
+use Closure;
+use OCA\Mail\Db\MessageMapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+use Psr\Log\LoggerInterface;
+
+class Version1140Date20221027171138 extends SimpleMigrationStep {
+ private LoggerInterface $logger;
+ private MessageMapper $messageMapper;
+
+ public function __construct(MessageMapper $messageMapper,
+ LoggerInterface $logger) {
+ $this->logger = $logger;
+ $this->messageMapper = $messageMapper;
+ }
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ */
+ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
+ if (!method_exists($this->messageMapper, 'resetPreviewDataFlag')) {
+ $this->logger->warning('Service method missing due to in process upgrade');
+ return;
+ }
+ $this->messageMapper->resetPreviewDataFlag();
+ }
+}