[
https://issues.apache.org/jira/browse/IO-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17575143#comment-17575143
]
Sita Geßner edited comment on IO-770 at 8/4/22 9:09 AM:
--------------------------------------------------------
Hi [~ArdenL_Liu]
thanks for investigating.
Like I mentioned in the description, I know that underscore is not valid, but
windows allows it and unfortunatly I have to deal with this.
It would be nice if you can add underscore in this pattern. If you don't want
this, an exception would be helpful to in this case.
was (Author: sgessner):
Hi [~ArdenL_Liu]
thanks for investigating.
Like I mentioned in the description, I know that underscore is not valid, but
windows allows it and unfortunatly I have to deal with this.
It would be nice if you can add underscore in this pattern.
> 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
(v8.20.10#820010)