[
https://issues.apache.org/jira/browse/IO-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved IO-770.
--------------------------------
Resolution: Fixed
[~sgessner] [~ArdenL_Liu] [~ArdenL_Liu]
This is now fixed in git master and snapshot builds in
[https://repository.apache.org/content/repositories/snapshots/commons-io/commons-io/2.23.0-SNAPSHOT/]
Please verify your uses cases and close this ticket if appropriate.
TY!
> FilenameUtils#getFullPathNoEndSeparator has issues with windows and
> underscore in hostname
> ------------------------------------------------------------------------------------------
>
> Key: IO-770
> URL: https://issues.apache.org/jira/browse/IO-770
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.7, 2.8.0, 2.9.0, 2.10.0, 2.11.0
> Reporter: Sita Geßner
> Priority: Major
>
> 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
> {code:java}
> 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()));
> }
> {code}
> We know hostnames are not supposed to have underscores, but windows allows it
> and unfortunatly we have to deal with this.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)