summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-12-10 22:32:46 +0100
committerThomas Bruederli <thomas@roundcube.net>2012-12-10 22:32:46 +0100
commit31521613e40bb57f430591bab30de2c202637db2 (patch)
tree23ffee7b1871b12a8d757fc3c82c92adc683937a
parenta8a72e2e7ee89caa04f8f13b6067e1b4ad870612 (diff)
Append filename extension if missing
-rw-r--r--program/steps/mail/get.inc5
1 files changed, 5 insertions, 0 deletions
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 7f06feb1a..314a437e7 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -266,6 +266,11 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
$filename = str_ireplace('attachment', 'attach', $filename);
}
+ // add filename extension if missing
+ if (!pathinfo($filename, PATHINFO_EXTENSION) && ($extensions = rcube_mime::get_mime_extensions($mimetype))) {
+ $filename .= '.' . $extensions[0];
+ }
+
header("Content-Disposition: $disposition; filename=\"$filename\"");
// handle tiff to jpeg conversion