Fix regression where some non-inline attachments could be not listed (#6291)

pull/6302/head
Aleksander Machniak 6 years ago
parent 647a7e91c6
commit 71eec07d25

@ -854,17 +854,16 @@ class rcube_message
) { ) {
$this->add_part($mail_part, 'inline'); $this->add_part($mail_part, 'inline');
} }
// regular attachment with valid content type
// (content-type name regexp according to RFC4288.4.2) // Any non-inline attachment
else if (preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) { if (!preg_match('/^inline/i', $mail_part->disposition)) {
$this->add_part($mail_part, 'attachment'); // Content-Type name regexp according to RFC4288.4.2
} if (!preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) {
// attachment with invalid content type // replace malformed content type with application/octet-stream (#1487767)
// replace malformed content type with application/octet-stream (#1487767) $mail_part->ctype_primary = 'application';
else if ($mail_part->filename) { $mail_part->ctype_secondary = 'octet-stream';
$mail_part->ctype_primary = 'application'; $mail_part->mimetype = 'application/octet-stream';
$mail_part->ctype_secondary = 'octet-stream'; }
$mail_part->mimetype = 'application/octet-stream';
$this->add_part($mail_part, 'attachment'); $this->add_part($mail_part, 'attachment');
} }

Loading…
Cancel
Save