You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Glavo (Jira)" <ji...@apache.org> on 2022/05/14 08:25:00 UTC

[jira] [Commented] (COMPRESS-621) ZipFile does not support prepending additional data to the zip content

    [ https://issues.apache.org/jira/browse/COMPRESS-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17536993#comment-17536993 ] 

Glavo commented on COMPRESS-621:
--------------------------------

Here is another more common example:

 

Starting with JDK 9, the JDK includes several .jmod files in the jmods directory.

jmod files are zip archives but with magic numbers ( 0x4A 0x4D 0x01 0x00) in the header, it caused commons compress's ZipFile to not be able to handle jmod files.

 

I wish Commons Compress would take care of this and add a new method to ZipFile for getting the bytes before the body content of the zip file.

> ZipFile does not support prepending additional data to the zip content
> ----------------------------------------------------------------------
>
>                 Key: COMPRESS-621
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-621
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.21
>            Reporter: Glavo
>            Priority: Major
>
> In general, Zip files support placing arbitrary content before their body without affecting their compliance.
> Here is an example:
> [https://github.com/huanghongxun/HMCL/releases/download/v3.5.2.218/HMCL-3.5.2.218.exe]
>  
> This is actually a jar file, but we prepend an exe launcher to it, so it can be used both as a jar and as an exe.
> java.util.zip.ZipFile can open and read it normally, but org.apache.commons.compress.archivers.zip.ZipFile can open it but cannot read any entries.
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)