Steven Verrell created COMPRESS-698:
---------------------------------------

             Summary: Unexpected Trailing Dot from 
FileNameUtil.getUncompressedFileName(String)
                 Key: COMPRESS-698
                 URL: https://issues.apache.org/jira/browse/COMPRESS-698
             Project: Commons Compress
          Issue Type: Bug
          Components: Compressors
    Affects Versions: 1.28.0
            Reporter: Steven Verrell


When I tried to identify the suffix of {{"archive.tar.gz"}} and convert it to a 
version with the {{"gz"}} suffix removed, I called: 
{{fileNameUtil.getUncompressedFileName(fileName)}} and got {{"archive.tar.", 
which includes an unexpected trailing dot.}}

Should the logic of {{getUncompressedFileName}} handle the dot when replacing 
suffixes?

 

 

The test code is as follows:


{code:java}
// Setup
Map<String, String> uncompressSuffixMap = new HashMap<>();
uncompressSuffixMap.put("gz", "");
FileNameUtil fileNameUtil = new FileNameUtil(uncompressSuffixMap, "default");

// Test case
String fileName = "archive.tar.gz";
String expected = "archive.tar";
String actual = fileNameUtil.getUncompressedFileName(fileName);
assertEquals(expected, actual); {code}
 



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

Reply via email to