From a39a466fedf3fa2e75189c26b3c95c55ed7990df Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 18 Dec 2017 11:27:23 +0100 Subject: [PATCH] * Mail: fix rename of an attachment and saving it into Filemanager always keep the original name of attachment with no respect to the given new name. --- mail/inc/class.mail_ui.inc.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 5076731407..c2031aa708 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2908,7 +2908,15 @@ $filter['before']= date("d-M-Y", $cutoffdate2); 'success' => true ); - $dir = Vfs::is_dir($path) ? $path : Vfs::dirname($path); + if (Vfs::is_dir($path)) + { + $dir = $path; + } + else + { + $dir = Vfs::dirname($path); + $filename = Vfs::basename($path); + } if (!Vfs::is_writable($dir)) { @@ -2988,7 +2996,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $attachment = $this->mail_bo->getAttachment($params['uid'],$params['part'],$params['is_winmail'],false); } - $file = $dir. '/' . preg_replace('$[\f\n\t\v\\:*#?<>\|/]$',"_",$attachment['filename']); + $file = $dir. '/' . ($filename ? $filename : preg_replace('$[\f\n\t\v\\:*#?<>\|/]$',"_",$attachment['filename'])); $counter = 1; $tmp_file = $file;