Skip to content

Commit a17dc2e

Browse files
committed
Format/convert only text-parts that are displayed, not downloaded
1 parent 794b71b commit a17dc2e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

program/include/rcmail_attachment_handler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ public function body($size = null, $fp = null)
199199
$result = fwrite($fp, $result) !== false;
200200
}
201201
} elseif ($this->message) {
202-
$result = $this->message->get_part_body($this->part->mime_id, $this->part->ctype_primary === 'text', 0, $fp);
202+
// Formatting also changes newlines, converts from charsets, etc.
203+
// Thus we only do this for parts that are to be shown in the
204+
// browser, not for other parts, or if the part is downloaded.
205+
$formatting_wanted = $this->part->ctype_primary === 'text' && !$this->download;
206+
$result = $this->message->get_part_body($this->part->mime_id, $formatting_wanted, 0, $fp);
203207

204208
// check connection status
205209
if (!$fp && $this->size && empty($result)) {

0 commit comments

Comments
 (0)