Fix duplicate suffix in filename created from message subject
authoralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 10 Dec 2003 23:40:20 +0000 (23:40 +0000)
committeralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 10 Dec 2003 23:40:20 +0000 (23:40 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6262 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/download.php

index b14cfd8f7d9a9d86d5efa23bfbb32772c95f3955..a7286c9513a05d64b4e03ce215a5607d10c250b9 100644 (file)
@@ -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;
 }
 
 /*