Aryan Ganjoo created COMPRESS-728:
-------------------------------------

             Summary: FileNameUtil mis-splits names when root lowercasing 
expands a character
                 Key: COMPRESS-728
                 URL: https://issues.apache.org/jira/browse/COMPRESS-728
             Project: Commons Compress
          Issue Type: Bug
            Reporter: Aryan Ganjoo


On current Commons Compress master, FileNameUtil lowercases the entire file 
name, uses the length of that lowercased result, and then applies that offset 
to the original string. Root lowercasing can expand a character: U+0130 
(capital I with dot) becomes two characters.

Reproduction: GzipUtils.getUncompressedFileName("İSTANBUL.tgz") currently 
returns "İSTANBUL..tar" instead of "İSTANBUL.tar". The reverse 
getCompressedFileName call similarly adds an extra dot. 
GzipUtils.getUncompressedFileName("İİİİ.gz") throws 
StringIndexOutOfBoundsException instead of returning "İİİİ". This affects the 
shared FileNameUtil path used by other compressor filename helpers as well.

A small local correction takes offsets from the original name and lowercases 
only each candidate suffix. The focused GzipUtilsTest passed 4 cases and the 
full Maven test suite passed 4,782 tests with 29 skipped on JDK 17. A 
standalone regression harness showed the new case failing before and passing 
after; no hosted CI or maintainer review yet.

AI Assistance used.



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

Reply via email to