- Fix content-type name regexp according to RFC4288.4.2

release-0.6
alecpl 14 years ago
parent 36260ed640
commit 2ae58f1b67

@ -45,7 +45,7 @@ class rcube_message
private $opt = array(); private $opt = array();
private $inline_parts = array(); private $inline_parts = array();
private $parse_alternative = false; private $parse_alternative = false;
public $uid = null; public $uid = null;
public $headers; public $headers;
public $structure; public $structure;
@ -55,7 +55,7 @@ class rcube_message
public $subject = ''; public $subject = '';
public $sender = null; public $sender = null;
public $is_safe = false; public $is_safe = false;
/** /**
* __construct * __construct
@ -105,8 +105,8 @@ class rcube_message
// notify plugins and let them analyze this structured message object // notify plugins and let them analyze this structured message object
$this->app->plugins->exec_hook('message_load', array('object' => $this)); $this->app->plugins->exec_hook('message_load', array('object' => $this));
} }
/** /**
* Return a (decoded) message header * Return a (decoded) message header
* *
@ -124,7 +124,7 @@ class rcube_message
return $raw ? $value : $this->imap->decode_header($value); return $raw ? $value : $this->imap->decode_header($value);
} }
/** /**
* Set is_safe var and session data * Set is_safe var and session data
* *
@ -468,8 +468,8 @@ class rcube_message
else if ($part_orig_mimetype == 'message/rfc822') { else if ($part_orig_mimetype == 'message/rfc822') {
$this->parse_structure($mail_part, true); $this->parse_structure($mail_part, true);
} }
// is a regular attachment // is a regular attachment (content-type name regexp according to RFC4288.4.2)
else if (preg_match('!^[a-z0-9-.+_]+/[a-z0-9-.+_]+$!i', $part_mimetype)) { else if (preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) {
if (!$mail_part->filename) if (!$mail_part->filename)
$mail_part->filename = 'Part '.$mail_part->mime_id; $mail_part->filename = 'Part '.$mail_part->mime_id;
$this->attachments[] = $mail_part; $this->attachments[] = $mail_part;

Loading…
Cancel
Save