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

ASF GitHub Bot logged work on COMPRESS-621:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Dec/22 14:01
            Start Date: 07/Dec/22 14:01
    Worklog Time Spent: 10m 
      Work Description: Glavo opened a new pull request, #334:
URL: https://github.com/apache/commons-compress/pull/334

   Since the zip central directory is at the file end, we can splice other 
content before the zip file.
   
   As an example, in Java 9 and above, the `$JAVA_HOME/jmods` folder contains 
some files with the extension `jmod`.
   The jmod file is a normal zip file, but the file starts with the four-byte 
magic number `0x4A 0x4D 0x01 0x00`.
   
   Another example, [Ammonite Shell](http://ammonite.io/) splices a bash shell 
script before the jar file, looks for Java through the bash shell script and 
starts itself.
   
   `java.util.zip.ZipFile` reads these files correctly, but 
`org.apache.commons.compress.archivers.zip.ZipFile` recognizes them as empty 
zip files.
   
   This PR fixes this issue and allows users to read content before the zip 
body.
   
   I didn't implement it for zip64 because `java.util.zip.ZipFile` didn't 
implement it either, and I'm not sure how it should be implemented correctly.
   
   (I seem to have missed the release date of commons-compress 1.22. This 
problem has a wider impact, and I hope to fix it as soon as possible.)
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 831776)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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.10#820010)

Reply via email to