[ 
https://issues.apache.org/jira/browse/COMPRESS-700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory updated COMPRESS-700:
-------------------------------------
    Description: We cannot extract from the file 
flutter_awesome_buttons-0.1.0.tar because we cannot detect that it is in the 
TAR format.  (was: Prior to version 1.26.1, calling ArchiveStreamFactory.detect 
on the attached TAR file identifies it as a TAR file properly but now throws an 
ArchiveException. It seems related to the changes to address COMPRESS-644, 
specifically the the entry.getSize() > 0 check on line 288 of 
ArchiveStreamFactory.java.

Below is some sample code to reproduce the error (the below code runs without 
errors when tested on 1.26.0):
{code:java}
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import java.io.BufferedInputStream;
import java.io.File;
import java.nio.file.Files;

import static 
com.sonatype.data.testing.utils.ResourcesUtils.getResourceAsInputStream;

public class TarArchiveTest
{
  @Test
  public void testTarArchive() throws Exception {
    String fileToTest = "icure_medical_device_dart_sdk-1.2.10.tar";
    File sourceFile = new File(fileToTest);
    FileUtils.copyInputStreamToFile(getResourceAsInputStream(fileToTest), 
sourceFile);

    BufferedInputStream fileInputStream = new 
BufferedInputStream(Files.newInputStream(sourceFile.toPath()));
    System.out.println("Detected archive type: " + 
ArchiveStreamFactory.detect(fileInputStream));
  }
} {code})

> Can't extract TAR file flutter_awesome_buttons-0.1.0.tar
> --------------------------------------------------------
>
>                 Key: COMPRESS-700
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-700
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.26.1, 1.26.2, 1.27.0, 1.27.1
>            Reporter: Michael Nguyen
>            Assignee: Gary D. Gregory
>            Priority: Major
>             Fix For: 1.28.0
>
>         Attachments: flutter_awesome_buttons-0.1.0.tar
>
>
> We cannot extract from the file flutter_awesome_buttons-0.1.0.tar because we 
> cannot detect that it is in the TAR format.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to