I’m having an interesting issue with the `staticZi...
# ktor
b
I’m having an interesting issue with the
staticZip
functionality on a mac. Using the demo
text-files.zip
in the ktor documentation example the
text-files.zip
loads just fine. But with zip files created on my mac, they never load. If I uncompress the zip file then recompress the folder using the built in compress method in the mac right click context menu that .zip doesn’t work properly. I tested the same thing with keka another zip app.
e
I didn't test macos zip but it's possible it's using Zip64, which Java had a host of problems with https://bugs.java.com/bugdatabase/view_bug?bug_id=8303866
b
I had ChatGPT analyze the differences between my zip of the sample dir and the sample zip and this is what it came up with
Copy code
1. "Extra N Bytes Preceding This File"
The working ZIP file shows entries like:

There are an extra 8 bytes preceding this file.
This indicates the presence of a data descriptor after the file data. This descriptor is used for files compressed with streaming tools and is common when the extended local header is enabled.

2. Extended Local Header Differences
The working ZIP file uses extended local header: yes for most files.
The problematic ZIP file shows extended local header: no.
Impact: Java's ZipInputStream may expect an extended local header for consistency, especially if the ZIP includes compressed entries.

3. Compression and Compatibility
The working ZIP file is compressed (compression method: deflated) for almost all entries.
The problematic ZIP file uses compression method: none (stored) for some files, which is valid but may cause inconsistencies in parsing.

4. Extra Field Metadata
Both ZIP files contain Unix-specific metadata (UID/GID, timestamps) in the extra field. This is consistent, so it's unlikely to be the cause of the issue.
It was able to come up with a workaround for mac users like me though. Run this command to create your zip file instead
jar cf <zip name> -C <directory> .
a
I cannot reproduce the problem with a zip file created on my Mac. Can you share the offending zip file?
b
Sure. Here’s the text-files.zip that I downloaded from the sample then immediately recompressed with Mac’s compress feature. I verified the previous zip file worked with staticZip as well as the new zip file not working with staticZip. I wonder if osx version has anything to do with it. I’m on Sequoia 15.0.1
a
Thank you. I've filed an issue to address the problem.
👍🏼 1