From 89c7fc5a9108a6140cdf7e03465ba237a39912be Mon Sep 17 00:00:00 2001 From: alex-brainstorm Date: Wed, 10 Dec 2003 23:40:20 +0000 Subject: [PATCH] Fix duplicate suffix in filename created from message subject git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6262 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/download.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/download.php b/src/download.php index b14cfd8f..a7286c95 100644 --- a/src/download.php +++ b/src/download.php @@ -93,29 +93,23 @@ if (is_object($message->header->disposition)) { $filename = $header->getParameter('name'); } +//$filename = decodeHeader($filename, false, false); //Don't want html output nor utf8 because it will return html output $filename = decodeHeader($filename, true, false); //Don't want html output if (strlen($filename) < 1) { - if ($type1 == 'plain' && $type0 == 'text') { + $filename = $subject; + if ($type1 == 'plain' && $type0 == 'text') $suffix = 'txt'; - $filename = $subject . '.txt'; - } else if ($type1 == 'richtext' && $type0 == 'text') { + else if ($type1 == 'richtext' && $type0 == 'text') $suffix = 'rtf'; - $filename = $subject . '.rtf'; - } else if ($type1 == 'postscript' && $type0 == 'application') { + else if ($type1 == 'postscript' && $type0 == 'application') $suffix = 'ps'; - $filename = $subject . '.ps'; - } else if ($type1 == 'rfc822' && $type0 == 'message') { - $suffix = 'eml'; - $filename = $subject . '.msg'; - } else { + else if ($type1 == 'rfc822' && $type0 == 'message') + $suffix = 'msg'; + else { + $filename = 'untitled' . strip_tags($ent_id); $suffix = $type1; } - - if (strlen($filename) < 1) { - $filename = 'untitled'.strip_tags($ent_id).'.'.$suffix; - } else { - $filename = "$filename.$suffix"; - } + $filename = $filename . '.' . $suffix; } /* -- 2.25.1