summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_message.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-02-09 12:33:07 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-02-09 12:33:07 +0000
commita67eb61c3c74cfe971aeeb9f5b01fb3ba4e22f6f (patch)
tree3eecbaa8651e16b36194e895329b4588b0a1a3dc /roundcubemail/program/include/rcube_message.php
parent0d5b29a28cbcf7b868f0712eb2629d4c77bfedf5 (diff)
- Fix handling of attachments with invalid content type (#1487767)
git-svn-id: https://svn.roundcube.net/trunk@4515 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_message.php')
-rw-r--r--roundcubemail/program/include/rcube_message.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_message.php b/roundcubemail/program/include/rcube_message.php
index 3a96a0b7b..a8c51cc4e 100644
--- a/roundcubemail/program/include/rcube_message.php
+++ b/roundcubemail/program/include/rcube_message.php
@@ -478,10 +478,21 @@ class rcube_message
if (!empty($mail_part->filename))
$this->attachments[] = $mail_part;
}
- // is a regular attachment (content-type name regexp according to RFC4288.4.2)
+ // regular attachment with valid content type
+ // (content-type name regexp according to RFC4288.4.2)
else if (preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) {
if (!$mail_part->filename)
$mail_part->filename = 'Part '.$mail_part->mime_id;
+
+ $this->attachments[] = $mail_part;
+ }
+ // attachment with invalid content type
+ // replace malformed content type with application/octet-stream (#1487767)
+ else if ($mail_part->filename) {
+ $mail_part->ctype_primary = 'application';
+ $mail_part->ctype_secondary = 'octet-stream';
+ $mail_part->mimetype = 'application/octet-stream';
+
$this->attachments[] = $mail_part;
}
}