hrehfeld / QuakeInjector

Download, install and play quake singleplayer maps from the quaddicted.com archive
https://www.quaddicted.com/tools/quake_injector
GNU General Public License v3.0
94 stars 15 forks source link

Couldn't open file! invalid compression method #146

Open SpiritQuaddicted opened 2 years ago

SpiritQuaddicted commented 2 years ago

Trying to install https://www.quaddicted.com/reviews/qbj_1.05.html the Injector fails to uncompress the ZIP archive and shows the user a message "Couldn't open file! invalid compression method".

No idea what might be wrong there. The file is "compressed" with "store" but I would assume that other files in the archive were using that "compression" already and I am not aware of issues.

https://www.quaddicted.com/filebase/qbj_1.05.zip

md5: 601bc9baa2b4226d101f16cb8cb45b65

ctsj2.zip:                 Zip archive data, at least v2.0 to extract, compression method=deflate
qbj_1.05.zip:              Zip archive data, at least v2.0 to extract, compression method=store
SpiritQuaddicted commented 2 years ago

I unpacked and packed it again with a simple "zip -r qbj_1.05.zip.zip qbj" and the resulting archive works fine.

However I noticed that my compressed version is about the same size (512MB) as the supposedly uncompressed "store" version (480MB). An actually uncompressed ZIP is at 1.5GB.

It seems like the compression method in the file's metadata might be mislabeled as "store" when it is actually compressed? Or something tripped off file and the information above is not actually true, with another problem.

SpiritQuaddicted commented 2 years ago

Yeah, file is wrong. unzip -v 1qbj_1.05.zip shows that files a compressed with "Def64N".

neogeographica commented 2 years ago

Yeah I ran into this problem myself. It happens for large zipfiles but also apparently for smaller zipfiles that have been incrementally updated: https://github.com/neogeographica/quakestarter/issues/84

In my case I was using a .NET assembly to do the unzip but it looks like java.util.Zip has the same problem.

Just unzipping and rezipping fixes the issue if the contents are less than 2GB. Don't know of a better solution unfortunately... maybe the best one can do is just to check using unzip -v to catch the problem.

SpiritQuaddicted commented 2 years ago

Argh... :(

https://stackoverflow.com/questions/34299045/java-compression-library-to-support-deflate64 suggests using https://commons.apache.org/proper/commons-compress/