Skip to content

Commit 8e2f620

Browse files
authored
Merge pull request barbushin#558 from barbushin/revert-551-fix-detect-textPlain-encoding
Revert "Fix for barbushin#525 How to detect textPlain encoding"
2 parents 302427b + 2cf2d30 commit 8e2f620

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/PhpImap/DataPartInfo.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ protected function convertEncodingAfterFetch(): string
109109
{
110110
if (isset($this->charset) and !empty(\trim($this->charset))) {
111111
$this->data = $this->mail->decodeMimeStr(
112-
(string) $this->data, // Data to convert
113-
(string) \trim($this->charset)
112+
(string) $this->data // Data to convert
114113
);
115114
}
116115

src/PhpImap/Mailbox.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,15 +1333,14 @@ public function downloadAttachment(DataPartInfo $dataInfo, array $params, object
13331333
* Decodes a mime string.
13341334
*
13351335
* @param string $string MIME string to decode
1336-
* @param string|null $charsetPreferred The charset of the data part info if it was set
13371336
*
13381337
* @return string Converted string if conversion was successful, or the original string if not
13391338
*
13401339
* @throws Exception
13411340
*
13421341
* @todo update implementation pending resolution of https://github.com/vimeo/psalm/issues/2619 & https://github.com/vimeo/psalm/issues/2620
13431342
*/
1344-
public function decodeMimeStr(string $string, ?string $charsetPreferred = null): string
1343+
public function decodeMimeStr(string $string): string
13451344
{
13461345
$newString = '';
13471346
/** @var list<object{charset?:string, text?:string}>|false */
@@ -1355,7 +1354,7 @@ public function decodeMimeStr(string $string, ?string $charsetPreferred = null):
13551354
$charset = \strtolower($element->charset);
13561355

13571356
if ('default' === $charset) {
1358-
$charset = !empty($charsetPreferred) ? $charsetPreferred : $this->decodeMimeStrDefaultCharset;
1357+
$charset = $this->decodeMimeStrDefaultCharset;
13591358
}
13601359

13611360
switch ($charset) {

0 commit comments

Comments
 (0)