summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-08-28 15:02:04 +0000
committeralecpl <alec@alec.pl>2010-08-28 15:02:04 +0000
commit47d06e46dfb5e8d616e578e5c04a263b526c7a06 (patch)
tree4564f0c0389e81fe53c9559961434e2fffcd4a47
parent2d27641cb593b92b9335bb0f19ae8a1d544a3244 (diff)
- Display inline images with known extensions and non-image content-type (#1486934)
-rw-r--r--CHANGELOG1
-rw-r--r--program/steps/mail/func.inc8
2 files changed, 8 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a92b3f5b2..65fbd2b50 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,6 +13,7 @@ CHANGELOG RoundCube Webmail
- Fix TinyMCE uses zh_CN when zh_TW locale is set (#1486929)
- Fix TinyMCE buttons are hidden in Opera (#1486922)
- Fix JS error on IE when trying to send HTML message with enabled spellchecker (#1486940)
+- Display inline images with known extensions and non-image content-type (#1486934)
RELEASE 0.4
-----------
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index ee33e9c1e..a87b7848b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1025,7 +1025,13 @@ function rcmail_message_body($attrib)
&& !empty($MESSAGE->attachments))
{
foreach ($MESSAGE->attachments as $attach_prop) {
- if (strpos($attach_prop->mimetype, 'image/') === 0) {
+ // Content-Type: image/*...
+ if (preg_match('/^image\//i', $attach_prop->mimetype) ||
+ // ...or known file extension: many clients are using application/octet-stream
+ ($attach_prop->filename &&
+ preg_match('/^application\/octet-stream$/i', $attach_prop->mimetype) &&
+ preg_match('/\.(jpg|jpeg|png|gif|bmp)$/i', $attach_prop->filename))
+ ) {
$out .= html::tag('hr') . html::p(array('align' => "center"),
html::img(array(
'src' => $MESSAGE->get_part_url($attach_prop->mime_id),