From: Michael M Slusarz Date: Wed, 10 Feb 2010 08:15:05 +0000 (-0700) Subject: Use content-disposition filename to get/set name of part X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=def9c44e5c1b45ef539502579ff80194051cf2de;p=horde.git Use content-disposition filename to get/set name of part --- diff --git a/framework/Mime/lib/Horde/Mime/Part.php b/framework/Mime/lib/Horde/Mime/Part.php index 46f4d79f6..5554a0290 100644 --- a/framework/Mime/lib/Horde/Mime/Part.php +++ b/framework/Mime/lib/Horde/Mime/Part.php @@ -309,6 +309,7 @@ class Horde_Mime_Part */ public function setName($name) { + $this->setDispositionParameter('filename', $name); $this->setContentTypeParameter('name', $name); } @@ -323,9 +324,9 @@ class Horde_Mime_Part */ public function getName($default = false) { - $name = $this->getContentTypeParameter('name'); - - if ($default && empty($name)) { + if (!($name = $this->getDispositionParameter('filename')) && + !($name = $this->getContentTypeParameter('name')) && + $default) { $name = preg_replace('|\W|', '_', $this->getDescription(false)); } @@ -642,9 +643,8 @@ class Horde_Mime_Part /** * Get the description of this part. * - * @param boolean $default If the name parameter doesn't exist, should we - * use the default name from the description - * parameter? + * @param boolean $default If the description parameter doesn't exist, + * should we use the name of the part? * * @return string The description of this part. */