zip-rs / zip-old

Zip implementation in Rust
MIT License
731 stars 204 forks source link

Error: InvalidArchive("Could not find central directory end") #315

Closed joelparkerhenderson closed 2 years ago

joelparkerhenderson commented 2 years ago

I'm attempting to unzip a file, and the crate is showing the error: InvalidArchive("Could not find central directory end")

The file is supposed to be a typical zip file that contains a spreadsheet.

I created a minimal example file (attached) by using LibreOffice Calc ODS. My understanding is the file is supposed to be a valid zip file.

For comparison, the file succeeds with the typical macOS unzip command:

$ unzip example.ods 
Archive:  example.ods
 extracting: mimetype                
  inflating: meta.xml                
  inflating: styles.xml              
   creating: Configurations2/toolbar/
   creating: Configurations2/progressbar/
   creating: Configurations2/images/Bitmaps/
   creating: Configurations2/popupmenu/
   creating: Configurations2/toolpanel/
   creating: Configurations2/menubar/
   creating: Configurations2/floater/
   creating: Configurations2/statusbar/
   creating: Configurations2/accelerator/
  inflating: manifest.rdf            
  inflating: content.xml             
  inflating: settings.xml            
 extracting: Thumbnails/thumbnail.png  
  inflating: META-INF/manifest.xml 

Is anyone here able to replicate the error with the example.ods file attached?

What are good troubleshooting steps please?

example.ods

zamazan4ik commented 2 years ago

Hi!

Could you please check it on the latest commit in master branch? I canont reproduce the issue with the latest commit in master branch on macOS (debug/release modes).

Also, could you please share your extraction source code? I am using the examples/extract.rs and it works fine on your file.

joelparkerhenderson commented 2 years ago

Thanks for verifying it works fine-- your help led me to the root cause, which is my fault; my main function was attempting to unzip arg 0 (i.e. the running program) rather than arg 1 (i.e. the data file).

You can delete this whole iissue if you want because it's not actually about zip at all. Thanks again.