[
https://issues.apache.org/jira/browse/IO-600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17255173#comment-17255173
]
Abhyankar Chaubey commented on IO-600:
--------------------------------------
Changes proposed for PR :
{code:java}
// this method doesn't check whether OS is Windows or Linux :
https://github.com/apache/commons-io/blob/master/src/main/java/org/apache/commons/io/FilenameUtils.java#L668
if (len == 2 && SystemUtils.IS_OS_LINUX){
return 0;
}
TestCase:
https://github.com/apache/commons-io/blob/master/src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java
@Test
public void testGetPrefixLengthForUnix() {
assertEquals(0, FilenameUtils.getPrefixLength("C:"));
}
{code}
> getPrefixLength returns wrong length on linux for filename "C:"
> ---------------------------------------------------------------
>
> Key: IO-600
> URL: https://issues.apache.org/jira/browse/IO-600
> Project: Commons IO
> Issue Type: Bug
> Affects Versions: 2.6
> Reporter: Patrick Bender
> Priority: Major
>
> On most unix filesystems only null byte and / are reserved characters. So its
> perfectly valid to have a file called "C:".
> If the getPrefixLength method is called for the path of such a file then it
> returns 2 whereas the expected value is 0.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)