Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZIP file appears to be corrupt when trying to unzip on some Mac computers. #61

Open
jamesmortensen opened this issue Nov 19, 2014 · 10 comments

Comments

@jamesmortensen
Copy link

Our first auto-update was a success. All our users got updated to the latest, but on our second update, we've seen issues with the ZIP file on some Mac computers but not all. It appears like the system is trying to unzip the ZIP before it's done downloading.

In this example, the actual uploaded ZIP is 58 MB, but one of our developers says he sees the system try to unzip the downloaded copy at 44 MB mark. We're not 100% sure this is the case, but we want to include this information just in case it helps.

Below is the error message we are seeing in the Dev Tools JavaScript console. We also see the error message when trying to unzip the downloaded ZIP via the terminal.

An error has occurred while trying to unpack the app :: 
Error: Command failed: /bin/sh -c unzip -xo /var/folders/vl/k1f7d2yx2mx7jvzgxx0k1q9m0000gp/T/synclio.zip >/dev/null 
End-of-central-directory signature not found. Either this file is not a zipfile, or it 
constitutes one disk of a multi-part archive. In the latter case the central directory
 and zipfile comment will be found on the last disk(s) of this archive. 

unzip: cannot find zipfile directory in one of /var/folders/vl/k1f7d2yx2mx7jvzgxx0k1q9m0000gp/T/synclio.zip or
    /var/folders/vl/k1f7d2yx2mx7jvzgxx0k1q9m0000gp/T/synclio.zip.zip

Please let us know if you need any more information.

@jamesmortensen
Copy link
Author

FYI, we are using the latest node-webkit-updater module version 0.2.3. Hope this helps!

@edjafarov
Copy link
Collaborator

This is good item to keep an eye on. Seems I saw behavior like this before. Thought we fixed it.
Theoretically you have access to content length of current pkg and you can check how many bytes were already downloaded https://github.com/edjafarov/node-webkit-updater/blob/master/app/index.html#L85
And if it says it is done before it was downloaded completely(connection timeout or smth) trigger another round of downloading.
Though It might make sense to put as a part of lib itself.

@ABeltramo
Copy link

Same error here!
The download goes to 100% and then tries to unpack. Strange thing is that if I manually unpack the download file it works (so i don't think it's corrupted).
Mac OSX 10.10 Yosemite.

@tarun1188
Copy link

@ABeltramo Are you able to unzip both the downloaded one ( in temp folder ) and the one you uploaded. ?
Sometimes the downloaded zip can be corrupt.

@ABeltramo
Copy link

@tarun1188 Yes! In temp folder if I double click the downloaded file the Mac standard unzipper extract the file correctly. The size of the downloaded size is equal to the one uploaded.

@robaweb
Copy link

robaweb commented Jan 12, 2015

I have same error

@robaweb
Copy link

robaweb commented Jan 12, 2015

I solved this error by setTimeout hack like:

upd.download(function (error, filename) {
   setTimeout(function(){
       upd.unpack(filename, function (err, _newAppPath) {
           ...
       })
   },1000);
});

I guess it is mean that .zip file still busy or not completed a few time after downloading and we need wait for free access ?

@ABeltramo
Copy link

setTimeout() also resolve the issue in my case!
Thank you!

@tarun1188
Copy link

In my case it's not consistent so i retry to unzip the download a couple of times. If it fails after "n" times i download the file again.

@BahgatMashaly
Copy link

for me my problem was using archive.end after archive.finalize
removing archive.end() solved my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants