McNetic/PHPZipStreamer

zip64 support should be enabled on request

DeepDiver1975 opened this issue · 16 comments

@McNetic if you are too busy at the moment we can collaborate on this - any pointers in the code are appreciated - THX

This seems to be a larger change request, according to the ZIP documentation you will need another file structure for 32 bit Zips.

I am on to it.

The main functionality of disabling zip64 support is now enabled in this branch, and can be tested. I think I will add some sanity checks (large files being streamed without zip64 enabled), and the deflate feature before doing the release.

Great news! Thanks a lot!

Thanks from here too!

However, I tried to use this within ownCloud. That's what I did:

git clone https://github.com/McNetic/PHPZipStreamer.git
cd PHPZipStreamer
git checkout 4ff61cebdd78e84fb116fcf3a4348cfca629b54c
cd -

cp -p /var/www/owncloud/3rdparty/mcnetic/phpzipstreamer/ZipStreamer.php ZipStreamer.php.org
cp PHPZipStreamer/*.md /var/www/owncloud/3rdparty/mcnetic/phpzipstreamer
cp -r PHPZipStreamer/src/* /var/www/owncloud/3rdparty/mcnetic/phpzipstreamer

vi /var/www/owncloud/3rdparty/mcnetic/phpzipstreamer/ZipStreamer.php
-> change line 55 from 'private $zip64 = True;' to 'private $zip64 = false;'

'Download as zip' now fails (blank page), the ownCloud error log says:

{"app":"PHP","message":"Class 'ZipStreamer' not found at \/var\/www\/owncloud\/lib\/private\/files.php#111","level":3,"time":"2014-10-01T13:11:58+00:00"}

For sure I've missed something, but what?

The Zipstreamer API changed sometime ago; the change is already in the owncloud git (owncloud/core#8034), but did not make it into the release yet. Additionally, changing ZipStreamer.php to disable zip64 support is not necessary (and not advisable); I suspect it will not work the way you did. You can disable zip64 support in the constructor.

We would need to incorporate this into the owncloud development branch first and in a second step we can decide on releasing an updated zipstreamer with the next owncloud 7.0.x release.

Thanks for your response, one more step.

I patched files.php and changed the path of phpzipstreamer accordingly (moved the files into a src subfolder) .
Furthermore I disabled zip64 in the constructor.

It works now, but there is still a problem with OS X:

  • Finder still can't unpack the zip file. Error message: Unable to expand "File.zip" into Downloads (Error 2 - No such file or directory)
  • However, the OS X command line unzip (the one from 2005...) is able to unpack the zip file without problems

Please let me know if I can provide further information.

The first problem (all files getting packed) is caused by owncloud. Zipstreamer does can not parse files and directories, all files have to be added separately, so your owncloud obviously does this. Why that should be is beyond me.

The second problem might still be caused by ZipStreamer. In all currently available versions, there is a bug that causes data descriptors not to be present although they are advertised (will be fixed soon, #13). It might also be a different bug or incompatibility. Unfortunately, from the finder error message, I do not get any information as to what else could possibly be wrong. A google search suggests the problem can also be caused by wrong permissions in OSX, so you might want to check that out, too.

The first problem (all files getting packed) was sort of 'pebkac' (me), I therefore removed this part of my comment yesterday.

The second problem is caused by the 'Archive Utility' of OS X. This tool is used to uncompress/unpack files if a user double clicks an archive file in Finder.
The zip from ownCloud seems to be fine. However, for some reason Archive Utility can't deal with it.

Is there a way to read the zip file 'header' information, maybe I can find what's bothering Archive Utility?

Same problem with IZArc Windows version : http://www.izarc.org/
Hope this info could help.

Ok. I merged the zip64_optional branch to master after fixing the problem with the missing data descriptors. As of current master, this seems to work correctly for me. It also works with current IZarc windows version, if Zip64 is disabled (IZarc appears not to have Zip64 support either). I can not test on OSX, however, so i'll be pleased when getting feedback.

Thanks!
Unfortunately the problem persists on OS X.
The cmdline unzip works but the GUI (Archive Utility) doesn't.
Please let me know if I can help in some way.

Please note that I was also working in getting ZipStreamer working for OSX. Thus, I created a pull request (#19) with some changes that made ZipStreamer generate zip archives that can be unarchived with 'unzip' as well as the OSX Finder GUI.

This issue is only about making zip64 support optional. The remaining issues with OSX are discussed here: #16