Code optimization, update changelog

pull/5755/merge
Aleksander Machniak 7 years ago
parent fa566b6b1e
commit fe4c626062

@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail
- Enigma: Fix compatibility with assets_dir
- Managesieve: Skip redundant LISTSCRIPTS command
- Fix SQL syntax error on MariaDB 10.2 (#5774)
- Fix bug where zipdownload ignored files with the same name (#5777)
RELEASE 1.3-rc
--------------

@ -3,7 +3,7 @@
"type": "roundcube-plugin",
"description": "Adds an option to download all attachments to a message in one zip file, when a message has multiple attachments. Also allows the download of a selection of messages in one zip file. Supports mbox and maildir format.",
"license": "GPLv3+",
"version": "3.2",
"version": "3.3",
"authors": [
{
"name": "Thomas Bruederli",

@ -182,8 +182,7 @@ class zipdownload extends rcube_plugin
}
}
}
/**
* Create and get display name of attachment part to add on zip file
*
@ -205,22 +204,20 @@ class zipdownload extends rcube_plugin
}
}
$displayname = $this->_convert_filename($filename);
$displayname = $this->_convert_filename($filename);
/**
* Adding a number before dot of extension on a name of file with same name on zip
* Ext: attach(1).txt on attach filename that has a attach.txt filename on same zip
*/
if (in_array($displayname, $this->names)) {
$attachNumber = 1;
if (isset($this->name[$displayname])) {
list($filename, $ext) = preg_split("/\.(?=[^\.]*$)/", $displayname);
foreach ($this->names as $name) {
if (preg_match("/{$filename}\((\d+)\)\.{$ext}/", $name, $match)) {
$attachNumber = ((int) $match[1]) + 1;
}
}
$displayname = $filename . '(' .$attachNumber . ').' . $ext;
$displayname = $filename . '(' . ($this->names[$displayname]++) . ').' . $ext;
$this->names[$displayname] = 1;
}
else {
$this->names[$displayname] = 1;
}
$this->names[] = $displayname;
return $displayname;
}

Loading…
Cancel
Save