MiriamCohenDev opened a new pull request, #825:
URL: https://github.com/apache/commons-io/pull/825

   Fixes a bug in FilenameUtils#normalizeNoEndSeparator when handling UNC paths 
that do not end with a slash.
   
   What:
   - The function normalizeNoEndSeparator incorrectly returned null for valid 
UNC paths like //server because it treated them as invalid.
   - This was caused by FilenameUtils#getPrefixLength returning -1 for UNC 
paths without a trailing slash.
   
   How:
   - Updated getPrefixLength to correctly handle UNC paths without a trailing 
slash, returning the proper prefix length instead of -1.
   - Updated and added unit tests to reflect the correct behavior, since many 
existing tests assumed null would be returned for these paths.
   
   Why:
   - Previous behavior caused valid UNC paths to be treated as invalid, which 
could break downstream logic that relies on normalizeNoEndSeparator.
   - This change ensures proper handling of UNC paths and maintains consistency 
across FilenameUtils methods.
   
   Testing:
   - Updated tests in FilenameUtilsTest to cover UNC paths without trailing 
slashes.
   - Verified that all tests pass with the new logic.
   
   Files changed:
   - `src/main/java/org/apache/commons/io/FilenameUtils.java`
   - `src/test/java/org/apache/commons/io/FilenameUtilsTest.java`
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to