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

Problem unzipping some xlsx files #105

Closed
jgwconsulting opened this issue Oct 23, 2013 · 17 comments
Closed

Problem unzipping some xlsx files #105

jgwconsulting opened this issue Oct 23, 2013 · 17 comments

Comments

@jgwconsulting
Copy link

Throwing 'Zip end of central directory signature not found (Zip::ZipError)'

See these two issues from separate gems that use RubyZip:

roo-rb/roo#80
weshatheleopard/rubyXL#60

@simonoff
Copy link
Member

@jgwconsulting can you share this xls file on which you getting this error?

@jgwconsulting
Copy link
Author

Would it be OK if I email it to you direct? It's not super sensitive but
I'd rather not share it publicly. Thanks for the quick response :-)
On 23 Oct 2013 06:12, "Alexander Simonov" notifications@github.com wrote:

@jgwconsulting https://github.com/jgwconsulting can you share this xls
file on which you getting this error?


Reply to this email directly or view it on GitHubhttps://github.com//issues/105#issuecomment-26881039
.

@simonoff
Copy link
Member

Sure. alex at simonov dot me

@vladCovaliov
Copy link

Have you found any working solution?

@jeromewilson
Copy link

I haven't heard anything back from Alex yet so my solution was to disallow .xlsx files. There's a suggestion here weshatheleopard/rubyXL#60 that it might be fixed as of RubyZip 1.0

What version of RubyZip is being included in your project Vlad?

@vladCovaliov
Copy link

I use 1.1.0 but my problem comes from a .xls file

@simonoff
Copy link
Member

I checked file from @jgwconsulting and it's opening fine. @vladCovaliov did you tried master branch?

@vladCovaliov
Copy link

I will try using the master branch. But actually, I'm not sure if my issue it's related to rubyzip. I am using 'roo' for parsing an xls, but my xls is not an archive. Though I'm not sure why I see this error.

@jeromewilson
Copy link

That is pretty odd. Might be worth giving RubyXL a try to see if that works? https://github.com/weshatheleopard/rubyXL

@weshatheleopard
Copy link
Contributor

The file @axelson provided was an XLS (binary) file, which is not a zip-file, so that bug was invalid.

@arkhov
Copy link

arkhov commented Jul 23, 2014

@jgwconsulting Note that password-protected XLSX files are not actually zip files

@duhast
Copy link

duhast commented Aug 14, 2014

Hello gentlemen,
I'd like to raise this issue again. The same exceptions is thrown while i'm sure my XLSX is a valid ZIP file.

Can anybody look into it please?
https://dl.dropboxusercontent.com/u/12564052/faulty.xlsx

I use the following ruby and gem versions:

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
  * roo (1.13.2)
  * axlsx (2.0.1 7cf7476)
  * rubyzip (1.1.6)

UPDATE: I've found the root of the problem - it turned out that wrong data is passed to CentralDirectory#get_e_o_c_d in my case, because i've saved an uploaded file improperly.
So ignore the request above and I hope this helps someone too.

@szymon-przybyl
Copy link

@duhast I have the same issue, how did you fixed uploading file to make it work?

@duhast
Copy link

duhast commented Sep 26, 2014

@szymon-przybyl as I remember, I've supplied uploaded file in the wrong way so it's contents was evaluatead as a stringActionDispatch::Http::UploadedFile instead of actual binary data.

@slavarybalka
Copy link

getting this exception when trying to process some of the docx files
using require 'docx'
on some files my script works fine and on the others it throws this exception

@zaeem
Copy link

zaeem commented Nov 2, 2016

@weshatheleopard It's .xlsx file and I am still getting error on windows and mac. You can see for yourself. here is the link. https://www.dropbox.com/s/5tnb7h2mm9h47ef/long%2Breport-4-11-01-2016.zip?dl=0

@MattPorto
Copy link

MattPorto commented Oct 28, 2019

Well, in 2019 I faced this bug, and for those who faced it too, here is how I fix this:

A error explanation (skip if you just want to fix it):
First, this is a .xlsx file problem. In my case, if I open the .xlsx file on LibreOffice, first the LibreOffice points a format error in a specific place of the spreadsheet. Second if I try to save it with a different name I got a format/content error warning by LibreOffice.

The solution:
I'm using roo to handle .xlsx files, and the @duhast answer above makes me got it. All I did was add a rescue for this error and save the file again as a temporary .csv file (on my context I don't need to care what is the specific format of the file actually, I just need to read them and extract it's data).

I have a gist exemplifying the snippet mentioned above.

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