From 31521613e40bb57f430591bab30de2c202637db2 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 10 Dec 2012 22:32:46 +0100 Subject: Append filename extension if missing --- program/steps/mail/get.inc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'program/steps') 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 -- cgit v1.2.3