6.0.0-beta1
7/8/25

[#8612] Download All Attachments (in .zip file) link generates corrupted zip files
Summary Download All Attachments (in .zip file) link generates corrupted zip files
Queue IMP
Queue Version 4.3.4
Type Bug
State Resolved
Priority 1. Low
Owners Horde Developers (at) , slusarz (at) horde (dot) org
Requester horde_contact (at) auchan (dot) com
Created 09/29/2009 (5761 days ago)
Due
Updated 04/20/2010 (5558 days ago)
Assigned 04/05/2010 (5573 days ago)
Resolved 04/07/2010 (5571 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/07/2010 10:44:36 PM Michael Slusarz Comment #14
State ⇒ Resolved
Reply to this comment
Done in Horde 3.3.7.
04/07/2010 10:43:57 PM CVS Commit Comment #13 Reply to this comment
Changes have been made in CVS for this ticket:

Bug: 8612
Merge from git master 746941e
http://cvs.horde.org/diff.php/horde/lib/core.php?rt=horde&r1=1.26.6.17&r2=1.26.6.18&ty=u
04/05/2010 03:21:24 AM Chuck Hagenbuch Comment #12 Reply to this comment
Seems like a reasonable one to make sure is set properly in core.php then...
04/05/2010 03:05:10 AM Michael Slusarz Comment #11
Assigned to Horde DevelopersHorde Developers
Reply to this comment
Sure - you can always change clean_output... but this really has 
nothing to do with this ticket.  This will be a problem with any 
non-html page served from horde.  Straight from the documentation, a 
giant warning:

Do not turn on tidy.clean_output if you are generating non-html 
content such as dynamic images.
04/05/2010 02:54:42 AM Chuck Hagenbuch Comment #10
Assigned to Michael Slusarz
State ⇒ Feedback
Reply to this comment
Is this a setting we can configure to avoid this problem?
03/22/2010 11:46:02 AM cedus (at) phreaker (dot) net Comment #9 Reply to this comment
We found the solution: you simply have to change "tidy.clean_output" 
to "Off" in your global php.ini and the zip-file won't get corrupted 
anymore. A look at various versions of freebsd (namely 6.0, 7.0 and 
8.0) with a standard LAMP-installation showed up, that this parameter 
changes without comment (= no release notes entry; at least I didn't 
find one)...
03/18/2010 01:36:29 PM cyx (at) gmx (dot) at Comment #8 Reply to this comment
Works for me.  Downloading a zip file with 21 attachments gets me this:



slusarz@schrute:~/Desktop$ zip -T test.zip

test of test.zip OK
Strange.
I have 2 machnines with identical versions of horde, imp installed 
(one on FBsd7 the other on FBsd8)
It works on the second one, but I have the corupted zip file errof on 
the first one.
Their zip.php files are ident ...
03/18/2010 01:36:23 PM cyx (at) gmx (dot) at Comment #7 Reply to this comment
Works for me.  Downloading a zip file with 21 attachments gets me this:



slusarz@schrute:~/Desktop$ zip -T test.zip

test of test.zip OK
Strange.
I have 2 machnines with identical versions of horde, imp installed 
(one on FBsd7 the other on FBsd8)
It works on the second one, but I have the corupted zip file errof on 
the first one.
Their zip.php files are ident ...
10/01/2009 03:12:23 PM Jan Schneider State ⇒ Not A Bug
 
10/01/2009 03:09:14 PM horde_contact (at) auchan (dot) com Comment #6 Reply to this comment
After lots of debugging, I've found that the 0x0a character is added 
by the PHP header() function:



- If I remove the call to downloadHeaders function in view.php, I have 
no extra character.

- if I replace the call to downloadHeaders with only one header() call 
(content-length one for example), I do have the extra 0x0a character 
before $body.



In any case, the zip file generated by $horde_compress->compress(...) 
is OK (wrote it down to a file, and tested it successfully with zip -T)



What I've done, is setting the content-Length header with 
strlen($body)+1. Thus, I still have an extra character in the 
beginning of the zip file (which does not prevent winzip from openning 
it), but I do not miss the last byte of the zip file.



Does anyone have an Idea of why header() acts like this or should I 
open a bug on PHP bugtracker ?



Anyway, you can close this ticket, as it is not horde/imp related.



Thanks for your help.
09/30/2009 08:46:19 AM Michael Slusarz Comment #5
Priority ⇒ 1. Low
Reply to this comment
Then you will need to find where that extra line break is coming from. 
  It isn't coming from either IMP's view.php or the Horde_Compress:: 
zip driver.



Horde_Compress::compress() sets the $contents variable to '' (the 
empty string).  On the first call to _addToZipFile(), the first data 
added to contents is $this->_fileHeader, which is "\x50\x4b\x03\x04".   
So that's not the issue.



view.php simply takes the output from compress and directly outputs 
it.  In the 1 line between the call to compress() and the echo call, 
there is no prepending of a linebreak.



you will need to trace on your system where the "\n" is coming from.
09/30/2009 08:36:52 AM horde_contact (at) auchan (dot) com Comment #4
New Attachment: zip_attachements2.zip Download
Reply to this comment
Of courde, the zip file I just provided is not as broken as expeted 
(just an extra byte at the beginning). Here is another one with two 
images inside. There is the same extra byte (0x0a) at the beginning, 
but zip can't even test it:

$ zip -T zip_attachements2.zip



zip error: Unexpected end of zip file (zip_attachements2.zip)
09/30/2009 08:26:56 AM horde_contact (at) auchan (dot) com Comment #3
New Attachment: zip_attachement.zip Download
Reply to this comment
I confirm it does not work for me. I use Horde Groupware Webmail 
Edition 1.2.3. Here is a detailed version list :

     * Dimp: H3 (1.1.2)

     * Horde: 3.3.4

     * Imp: H3 (4.3.4)

     * Ingo: H3 (1.2.1)

     * Kronolith: H3 (2.3.1)

     * Mimp: H3 (1.1.1)

     * Mnemo: H3 (2.2.1)

     * Nag: H3 (2.3.2)

     * Turba: H3 (2.3.1)



The version of the file lib/Horde/Compress/zip.php is

   * $Horde: framework/Compress/Compress/zip.php,v 1.11.12.22 
2009/01/06 15:22:59 jan Exp $



I join a zip downloaded from imp (it should contain the 
horde-halfgear.png logo).



$ od -xc zip_attachement.zip|head

0000000    500a    034b    1404    0000    0800    7600    3e52    363b

          \n   P   K 003 004 024  \0  \0  \0  \b  \0   v   R   >   ;   6

0000020    2d6f    866d    000e    8100    000e    1200    0000    6800

           o   -   m 206 016  \0  \0 201 016  \0  \0 022  \0  \0  \0   h

0000040    726f    6564    682d    6c61    6766    6165    2e72    6e70

           o   r   d   e   -   h   a   l   f   g   e   a   r   .   p   n

0000060    0167    0e81    f17e    5089    474e    0a0d    0a1a    0000

           g 001 201 016   ~ 361 211   P   N   G  \r  \n 032  \n  \0  \0

0000100    0d00    4849    5244    0000    9b00    0000    5800    0608

          \0  \r   I   H   D   R  \0  \0  \0 233  \0  \0  \0   X  \b 006
09/29/2009 09:52:26 PM Michael Slusarz Comment #2
State ⇒ Feedback
Reply to this comment
Works for me.  Downloading a zip file with 21 attachments gets me this:



slusarz@schrute:~/Desktop$ zip -T test.zip

test of test.zip OK
09/29/2009 10:28:06 AM horde_contact (at) auchan (dot) com Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ Download All Attachments (in .zip file) link generates corrupted zip files
Type ⇒ Bug
Queue ⇒ IMP
Reply to this comment
When trying to download all attachments of an e-mail as zip file, the 
zip file is corrupted. The first thing I see is that the zip file 
begins with characters 0x0a, "P", "K". A regular zip file begins 
directly with "P", "K". Removing this first 0x0a character is not 
enough to repair the zip file.

Saved Queries