Closed kierans closed 11 years ago
I thought I had solved image problems but I guess not. Can you run npm test
and let me know the results?
Also, are there any files you can upload for me to debug with?
If not, what happens when you attempt to zip/unzip a standalone binary file?
I ran npm test with NodeJS 0.8.22-linux-x64, 0.9.12-linux-x64 and 0.10.0-linux-x64 (Debian Squeeze 64bit) and all the tests passed.
I used @twolfson's Avatar as my binary test file, and the problem occurs if the file is in a dir structure. If the file is in the root of the zip it is OK.
$ unzip -t archive.zip
Archive: archive.zip
testing: 15927fc52919e9223adc7ed99e125d4d.jpeg OK
No errors detected in compressed data of archive.zip.
$ unzip -t archive.zip
Archive: archive.zip
testing: tmp/
error: invalid compressed data to inflate
testing: tmp/15927fc52919e9223adc7ed99e125d4d.jpeg OK
At least one error was detected in archive.zip.
There's also a problem with empty files too.
$ unzip -t archive.zip
Archive: archive.zip
testing: emptyfile.txt
error: invalid compressed data to inflate
At least one error was detected in archive.zip.
Interesting... would you mind commiting your progress to a gist a linking me?
Ah, nvm. I just realized gists hate folders -_-
There's really not that much to share anyway ;-). Create a folder, place your avatar (or another binary image) into that folder and setup a Gruntfile.js to zip up that folder.
module.exports = function(grunt) {
grunt.initConfig({
zip: {
app: {
src: [ 'tmp/15927fc52919e9223adc7ed99e125d4d.jpeg' ],
dest: 'archive.zip'
}
}
});
grunt.loadNpmTasks('grunt-zip');
};
$ grunt zip:app
Alright, I just got mine running. I found that unzip archive.zip
extracts everything just fine so it is really just a CRC32 problem. I will continue looking deeper.
I seem to have gotten it working by dealing with #2
I guess I will let 'deflate' be an opt-in option. I will patch this up in a second.
Alright, I have completed my patches. If you upgrade to grunt-zip@0.6.0
, you will be back in business. Please let me know if you run into any more problems =)
After I zipped a file using grunt-zip:zip, I tried unzipping it with the grunt-zip:unzip feature and got an error:
Running "unzip:app" (unzip) task Warning: Corrupted zip : CRC32 mismatch Use --force to continue.
I tested the archive with
unzip -t
and found errors with binary data (eg: images) and empty files in the archive. It specifically is a zip of a Symfony2 project so that I can distribute it to others.I tried out grunt-contrib-compress and it too is having problems creating zips, perhaps this plugin is affected by the same bug (https://github.com/gruntjs/grunt-contrib-compress/issues/29#issuecomment-15499057)
I've commented over there as well.