summaryrefslogtreecommitdiff
path: root/program/steps/mail/get.inc
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-02-07 18:17:25 +0100
committerThomas Bruederli <thomas@roundcube.net>2013-02-07 18:17:25 +0100
commit921115ed56cfcd0527b94bf599d4a80bc7f86616 (patch)
treef6dd45a0490e93e7af1f48a91ab1adeac2615afc /program/steps/mail/get.inc
parent4223b1e38ff38d74101cc2e2d6b33bb1050cf716 (diff)
Ignore file extension difference for text/plain attachments (#1488891)
Diffstat (limited to 'program/steps/mail/get.inc')
-rw-r--r--program/steps/mail/get.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index fddb40ae8..84e666fbe 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -121,7 +121,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
$valid = $file_extension && in_array($file_extension, (array)$extensions);
// 2. detect the real mimetype of the attachment part and compare it with the stated mimetype and filename extension
- if ($valid || !$file_extension || $mimetype == 'application/octet-stream') {
+ if ($valid || !$file_extension || $mimetype == 'application/octet-stream' || $mimetype == 'text/plain') {
if ($part->body) // part body is already loaded
$body = $part->body;
else if ($part->size && $part->size < 1024*1024) // load the entire part if it's small enough
@@ -133,6 +133,10 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
$real_mimetype = rcube_mime::file_content_type($body, $part->filename, $mimetype, true, true);
list($real_ctype_primary, $real_ctype_secondary) = explode('/', $real_mimetype);
+ // accept text/plain with any extension
+ if ($real_mimetype == 'text/plain' && $real_mimetype == $mimetype)
+ $file_extension = 'txt';
+
// ignore differences in text/* mimetypes. Filetype detection isn't very reliable here
if ($real_ctype_primary == 'text' && strpos($mimetype, $real_ctype_primary) === 0)
$real_mimetype = $mimetype;