[ https://issues.apache.org/jira/browse/COMPRESS-698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17952688#comment-17952688 ]
Gary D. Gregory commented on COMPRESS-698: ------------------------------------------ Hello [~ilikeprogramming] It looks like you're not building the {{FileNameUtil}} instance correctly, see: - {{org.apache.commons.compress.compressors.gzip.GzipUtils.\{...\}}} - {{org.apache.commons.compress.compressors.GzipUtilsTest.testGetUncompressedFilename()}} > 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 > Priority: Major > > 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)