blakelee
11/16/2024, 5:27 PMstaticZip
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.ephemient
11/16/2024, 7:33 PMblakelee
11/16/2024, 8:16 PM1. "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> .
Aleksei Tirman [JB]
11/18/2024, 8:36 AMblakelee
11/18/2024, 5:51 PMAleksei Tirman [JB]
11/19/2024, 12:42 PM