summaryrefslogtreecommitdiff
path: root/program/steps/mail/get.inc
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-12-28 12:40:57 +0100
committerAleksander Machniak <alec@alec.pl>2012-12-28 12:40:57 +0100
commitbe72fb3597c21ca3aaa058adf41bb72d53d197c7 (patch)
treef1f77633fb77f105305967b760f7d37a8372409d /program/steps/mail/get.inc
parent8809a1828477101ade03b261662df089e268ecb4 (diff)
Unified attachments filenames handling for message parts without a filename
Diffstat (limited to 'program/steps/mail/get.inc')
-rw-r--r--program/steps/mail/get.inc21
1 files changed, 2 insertions, 19 deletions
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 803716d61..37f728ebf 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -47,13 +47,7 @@ check_storage_status();
// show part page
if (!empty($_GET['_frame'])) {
if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id])) {
- $filename = $part->filename;
- if (empty($filename) && $part->mimetype == 'text/html') {
- $filename = rcube_label('htmlmessage');
- }
- if (!empty($filename)) {
- $OUTPUT->set_pagetitle($filename);
- }
+ $OUTPUT->set_pagetitle(rcmail_attachment_name($part));
}
$OUTPUT->send('messagepart');
@@ -236,18 +230,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
// don't kill the connection if download takes more than 30 sec.
@set_time_limit(0);
- if ($part->filename) {
- $filename = $part->filename;
- }
- else if ($part->mimetype == 'text/html') {
- $filename = rcube_label('htmlmessage');
- }
- else {
- $ext = '.' . ($mimetype == 'text/plain' ? 'txt' : $ctype_secondary);
- $filename = ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube') . $ext;
- }
-
- $filename = preg_replace('[\r\n]', '', $filename);
+ $filename = rcmail_attachment_name($part);
if ($browser->ie && $browser->ver < 7)
$filename = rawurlencode(abbreviate_string($filename, 55));