Author Topic: download all attachments in one zip file  (Read 33658 times)

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
Re: download all attachments in one zip file
« Reply #30 on: July 25, 2016, 07:32:21 AM »
the zipdownload plugin has been distributed with roundcube since about version 0.9 I think so it should be already in your plugins folder. all you need to do is configure an enable it.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline volcano

  • Newbie
  • *
  • Posts: 5
Re: download all attachments in one zip file
« Reply #31 on: July 26, 2016, 01:12:55 AM »
JohnDoh
Thank you! I was just not enough attentive.

Offline volcano

  • Newbie
  • *
  • Posts: 5
Re: download all attachments in one zip file
« Reply #32 on: July 29, 2016, 02:25:29 AM »
I fired up this plugin, but it has an issue with cyrillic filenames. When I open downloaded archive with attachments their filenames are broken. Does anybody know how to fix it?

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: download all attachments in one zip file
« Reply #33 on: July 29, 2016, 03:13:28 AM »
This is zip format problem. https://bugs.php.net/bug.php?id=51929. You can try to change zipdownload_charset, but I'm afraid there's no good solution for this.

Offline vitg

  • Newbie
  • *
  • Posts: 1
Re: download all attachments in one zip file
« Reply #34 on: September 20, 2016, 04:15:17 PM »
There is a problem with unique file names in zip archive.

You can fix it at zipdownload.php

Code: [Select]
            ....
            +$arrLocalNames = array();

            foreach ($message->attachments as $part) {
            ....

Code: [Select]
            ....
            $disp_name   = $this->_convert_filename($filename);
 
            +if (!empty($disp_name))
            +{
            +  // We have to make sure that there aren't two of the same local names.
            +  // Otherwise, one file will override the other and we will be missing the file.
            +  while($arrLocalNames[$disp_name] > 0)
            +   {
            +    $arrPathInfo = pathinfo($disp_name);
            +      $intNext = $arrLocalNames[$disp_name]++;
            +      $disp_name = $arrPathInfo['filename'] . "_" . $intNext . "." . $arrPathInfo['extension'];
            +   }
            +  // Add to the count.
            +  $arrLocalNames[$disp_name]++;                                       
            +}
           
            $tmpfn       = tempnam($temp_dir, 'zipattach');
            ....

Have a nice day! :)