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:
authorDaniel Kesselberg <mail@danielkesselberg.de>2022-11-13 23:59:31 +0300
committerDaniel Kesselberg <mail@danielkesselberg.de>2022-11-13 23:59:31 +0300
commit9d814db45fd40ff75c28af337752759eeaef8a05 (patch)
tree325f975f9c297867d6e111fcf5ab339b5a69c2d8
parent2ba336c27de6de9eeddeb988c199ff786cdc1654 (diff)
Don't decode content for preview twicebug/7408/double-decoding-preview-text
HTML and Text body are already decoded by Horde. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r--lib/IMAP/MessageMapper.php13
-rw-r--r--lib/Migration/Version1140Date20221113205737.php59
2 files changed, 60 insertions, 12 deletions
diff --git a/lib/IMAP/MessageMapper.php b/lib/IMAP/MessageMapper.php
index 546085056..d531a639d 100644
--- a/lib/IMAP/MessageMapper.php
+++ b/lib/IMAP/MessageMapper.php
@@ -726,22 +726,11 @@ class MessageMapper {
$part = $parts[$fetchData->getUid()];
$htmlBody = $part->getBodyPart($htmlBodyId);
if (!empty($htmlBody)) {
- $mimeHeaders = $part->getMimeHeader($htmlBodyId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
- if ($enc = $mimeHeaders->getValue('content-transfer-encoding')) {
- $structure->setTransferEncoding($enc);
- }
- $structure->setContents($htmlBody);
- $html = new Html2Text($structure->getContents());
+ $html = new Html2Text($htmlBody);
return new MessageStructureData($hasAttachments, trim($html->getText()), $isImipMessage);
}
$textBody = $part->getBodyPart($textBodyId);
if (!empty($textBody)) {
- $mimeHeaders = $part->getMimeHeader($textBodyId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
- if ($enc = $mimeHeaders->getValue('content-transfer-encoding')) {
- $structure->setTransferEncoding($enc);
- $structure->setContents($textBody);
- return new MessageStructureData($hasAttachments, $structure->getContents(), $isImipMessage);
- }
return new MessageStructureData($hasAttachments, $textBody, $isImipMessage);
}
diff --git a/lib/Migration/Version1140Date20221113205737.php b/lib/Migration/Version1140Date20221113205737.php
new file mode 100644
index 000000000..53a06c4b0
--- /dev/null
+++ b/lib/Migration/Version1140Date20221113205737.php
@@ -0,0 +1,59 @@
+<?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 Version1140Date20221113205737 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();
+ }
+}