* 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.

This commit is contained in:
Hadi Nategh 2017-12-18 11:27:23 +01:00
parent e9d82bcadc
commit a39a466fed

View File

@ -2908,7 +2908,15 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
'success' => true '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)) 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); $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; $counter = 1;
$tmp_file = $file; $tmp_file = $file;