Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.7, 2.8.0, 2.9.0, 2.10.0, 2.11.0
-
None
-
None
Description
After updating commons-io to version 2.11.0 there is an issue with FilenameUtils#getFullPathNoEndSeparator only when using Windows.
When using Linux there are no problems.
getFullPathNoEndSeparator returns null if the hostname of the path contains an underscore. This issue occured since version 2.7
private static void commonsIo() { final String result = getSubFolderFromFile(new File("\\\\sub_1.example.com\\path\\subfolder\\test.pdf")); // Fails in common-io:2.11.0 b/c result is null. System.out.println("result should be \"subfolder\", but it is: " + result); } private static String getSubFolderFromFile(final File file) { return FilenameUtils.getBaseName(FilenameUtils.getFullPathNoEndSeparator(file.getAbsolutePath())); }
We know hostnames are not supposed to have underscores, but windows allows it and unfortunatly we have to deal with this.