From 576b330ebd2541d89319ca4ef04e2fde172d2cc8 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 24 Nov 2010 06:55:55 -0500
Subject: [PATCH] - Temporarily commented out \Noselect flag checking in select(), because of problems with Courier

---
 program/include/rcube_message.php |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php
index fd42e4a..89d65eb 100644
--- a/program/include/rcube_message.php
+++ b/program/include/rcube_message.php
@@ -45,7 +45,7 @@
     private $opt = array();
     private $inline_parts = array();
     private $parse_alternative = false;
-  
+
     public $uid = null;
     public $headers;
     public $structure;
@@ -55,7 +55,7 @@
     public $subject = '';
     public $sender = null;
     public $is_safe = false;
-  
+
 
     /**
      * __construct
@@ -105,8 +105,8 @@
         // notify plugins and let them analyze this structured message object
         $this->app->plugins->exec_hook('message_load', array('object' => $this));
     }
-  
-  
+
+
     /**
      * Return a (decoded) message header
      *
@@ -124,7 +124,7 @@
         return $raw ? $value : $this->imap->decode_header($value);
     }
 
-  
+
     /**
      * Set is_safe var and session data
      *
@@ -448,7 +448,9 @@
                 }
                 // part is a file/attachment
                 else if (preg_match('/^(inline|attach)/', $mail_part->disposition) ||
-                    $mail_part->headers['content-id'] || (empty($mail_part->disposition) && $mail_part->filename)
+                    $mail_part->headers['content-id'] ||
+                    ($mail_part->filename &&
+                        (empty($mail_part->disposition) || preg_match('/^[a-z0-9!#$&.+^_-]+$/i', $mail_part->disposition)))
                 ) {
                     // skip apple resource forks
                     if ($message_ctype_secondary == 'appledouble' && $secondary_type == 'applefile')
@@ -468,8 +470,8 @@
                     else if ($part_orig_mimetype == 'message/rfc822') {
                         $this->parse_structure($mail_part, true);
                     }
-                    // is a regular attachment
-                    else if (preg_match('!^[a-z0-9-.+]+/[a-z0-9-.+]+$!i', $part_mimetype)) {
+                    // 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)) {
                         if (!$mail_part->filename)
                             $mail_part->filename = 'Part '.$mail_part->mime_id;
                         $this->attachments[] = $mail_part;

--
Gitblit v1.9.1