Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-538

ZipEntry created using ZipArchiveOutputStream(File) constructor adds 'ZIP64 Extended Information Extra Field' even when zip64 is not required.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.8, 1.9, 1.20
    • None
    • Archivers
    • None

    Description

      When creating a zip file using ZipArchiveOutputStream(File) constructor each entry get an extra `Zip64ExtendedInformationExtraField` header which shouldn't be there.

       

      The issue can be reproduced using below code sample

          public static void main(String[] args) throws IOException {
              // Create file
              final File file = File.createTempFile("apache_", ".zip");
              try ( ZipArchiveOutputStream zos = new ZipArchiveOutputStream(file)) {
                  zos.putArchiveEntry(new ZipArchiveEntry("TextFile1.txt"));
                  zos.closeArchiveEntry();
              }
      
              // List Headers File
              final ZipFile zipFile = new ZipFile(file);
              final Enumeration<? extends ZipArchiveEntry> entries = zipFile.getEntries();
              while (entries.hasMoreElements()) {
                  final ZipArchiveEntry entry = entries.nextElement();
                  for (ZipExtraField zipExtraField : entry.getExtraFields()) {
                      System.out.println("EntryName:" + entry.getName() + " Header: "+ zipExtraField.getHeaderId().getValue()); // Header shouldn't be present.
                  }
              }
          }
      

      Attachments

        Activity

          People

            peterlee Peter Lee
            Bandi Pritesh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: