Use the central dir instead of the local file header (+ other patches) #31

merged 3 commits into from Feb 8, 2013

2 participants


This fixes 3 issues :

  • folder() should be like remove() : without any argument, just return this.
  • when generating a zip file, the "is a directory" flag wasn't set.
  • reading nested zip files with data descriptors didn't work. The fix don't try to read/guess the size of the compressed data (we know it from the central dir), it should help the issue #30.

See the commit messages for more details.

dduponchel added some commits Feb 6, 2013
@dduponchel dduponchel folder() shouldn't throw an exception
Like remove(), without any argument, we should just return `this`.
@dduponchel dduponchel Fix : the folders wasn't marked as folder.
Also, add some unit tests.
@dduponchel dduponchel Load zip : a new way to read them.
Instead of reading the central dir and then the local dir (and trying to
handle all the cases, data descriptors, data descriptors with zip64, etc)
I just read the central dir, hoping that everything is here. (The only
exception is the file name : for some reasons, some zip have the real
name : with / instead of \ in the local dir)

This fixes an issue with nested zip files and data descriptors. When the
size was 0 in the local dir, we would seek the next occurence of the
data descriptor signature. With zip containing data descriptors, this
would lead to a bug.

This should also help the issue #30 : the new code avoids the overhead of
looking for data descriptors.

Other change : I explained the limitations of the zip64 extensions in
the browser.

Looks good!

@Stuk Stuk merged commit e45a4d7 into Stuk:master Feb 8, 2013
@dduponchel dduponchel deleted the dduponchel:issue30 branch Feb 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment