summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-08-02 08:35:31 +0200
committerAleksander Machniak <alec@alec.pl>2013-08-02 08:43:08 +0200
commit254af68cd8e27880276473d1583d18d221f8504d (patch)
tree0442f2ad2eac34efbf577842cdfb2cad0233f5bf /program
parentf2d12f4363568a8690920241023c93aea8a1b63d (diff)
Fix broken (in 93b0a30c1c8aa29d862b587b31e52bcc344b8d16) text/plain body of a message when using "edit as new"
Diffstat (limited to 'program')
-rw-r--r--program/steps/mail/compose.inc15
1 files changed, 10 insertions, 5 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index e04986a76..fb76b9abb 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -985,12 +985,17 @@ function rcmail_create_draft_body($body, $bodyIsHtml)
$cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml);
}
- // clean up html tags - XSS prevention (#1489251)
- $body = rcmail_wash_html($body, array('safe' => 1), $cid_map);
+ // clean up HTML tags - XSS prevention (#1489251)
+ if ($bodyIsHtml) {
+ $body = rcmail_wash_html($body, array('safe' => 1), $cid_map);
- // replace cid with href in inline images links
- if ($cid_map) {
- $body = str_replace(array_keys($cid_map), array_values($cid_map), $body);
+ // remove comments (produced by washtml)
+ $body = preg_replace('/<!--[^>]+-->/', '', $body);
+
+ // replace cid with href in inline images links
+ if (!empty($cid_map)) {
+ $body = str_replace(array_keys($cid_map), array_values($cid_map), $body);
+ }
}
return $body;