-
Notifications
You must be signed in to change notification settings - Fork 53
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
Non-standard zip file #1
Comments
I see the reason for the badly-formed zip files. There are a few places in the code like this is used to write a file into a zip archive.
The problem is with the second half of the code where it uses the You should use the Something like this should do what you need.
|
Wow, thank you for this incredibly in-depth analysis (and response on Stack Overflow)! We'll get this fix wrapped into the next minor release. |
I just pushed geoboundaries 2.0.1, which contains this fix (alongside a few other minor fixes). Thanks again for the report and help with the solution! |
No problem. Glad to help |
Updating my local copy with master
updating my local copy with master
I've just answered a question on StackOverflow (here) about an issue someone was having uncompressing a zip file from your site https://www.geoboundaries.org/. The exact file was https://www.geoboundaries.org/data/geoBoundaries-2_0_0/NGA/ADM1/geoBoundaries-2_0_0-NGA-ADM1-all.zip. I've check other zip files on your site & they all have the same issue.
The fundamental issue is the filenames stored in the
central-header
and the equivalentlocal-header
sections of the zip files should be identical. In this case they are not.I'm seeing the
central-header
filename entries without any leading path components, the matchinglocal-header
entries do have a leading path. For example,geoBoundaries-2_0_0-NGA-ADM1-shp.zip
in thecentral-header
andrelease/geoBoundaries-2_0_0/NGA/ADM1/geoBoundaries-2_0_0-NGA-ADM1-shp.zip
in thelocal-header
That means the zip files are badly-formed. See the StackOverflow write-up for more details.
There are a couple of implications with the zip files in their current format
The uncompression behaviour will vary depending on the unzipping utility used.
The person reporting the issue on StackOverflow saw two different behaviours.
The zip file may get flagged as malicious.
See here for details.
Looking briefly at the Python code in this repository it appears that zipfile is being used, I didn't think that Python would let you create a badly-formed zip file.
Is that how you are creating these zip files?
The text was updated successfully, but these errors were encountered: