[
https://issues.apache.org/jira/browse/IO-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980428#comment-15980428
]
ASF GitHub Bot commented on IO-499:
-----------------------------------
Github user asfgit closed the pull request at:
https://github.com/apache/commons-io/pull/20
> FilenameUtils.directoryContains(String, String) gives false positive when two
> directories exist with equal prefixes
> -------------------------------------------------------------------------------------------------------------------
>
> Key: IO-499
> URL: https://issues.apache.org/jira/browse/IO-499
> Project: Commons IO
> Issue Type: Bug
> Affects Versions: 2.4
> Reporter: Federico Bonelli
> Priority: Minor
>
> In a folder layout as such:
> {code}
> /foo/a.txt
> /foo2/b.txt
> {code}
> The result of invoking directoryContains is wrong:
> {code}
> FilenameUtils.directoryContains("/foo", "/foo2/b.txt"); // returns true
> {code}
> even if "/foo" and "/foo2/b.txt" are the canonical paths, they start with the
> same characters, and the current implementation of the method fails.
> As workaround we are currently appending a path separator '/' to the first
> argument.
> It is noteworthy that the current implementation of
> FileUtils.directoryContains() reveals this issue because it uses the
> File.getCanonicalPath() to obtain the String paths of "/foo" and
> "/foo2/b.txt".
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)