You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/03/26 13:04:00 UTC

[jira] [Work logged] (IO-727) FilenameUtils.directoryContains() and FileUtils.directoryContains() return wrong result when parent and child have the same path prefix

     [ https://issues.apache.org/jira/browse/IO-727?focusedWorklogId=572644&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-572644 ]

ASF GitHub Bot logged work on IO-727:
-------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Mar/21 13:03
            Start Date: 26/Mar/21 13:03
    Worklog Time Spent: 10m 
      Work Description: trungPa opened a new pull request #217:
URL: https://github.com/apache/commons-io/pull/217


   - Fix `FilenameUtils.directoryContains`. Add a file separator to the end of the parent directory to avoid treating files having the same prefix as subdirectories. `directoryContains` will return false when either parent or child is empty.
   - Explicitly state in the docs that the input paths are expected to be canonical.
   - Add a new test case for FilenameUtils.directoryContains.
   - Replace `testIO466` with a new test case to demonstrate the bug (the current `testIO466` will always pass because fooFile doesn't exist)
   
   Jira: https://issues.apache.org/jira/browse/IO-727


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 572644)
    Remaining Estimate: 0h
            Time Spent: 10m

> FilenameUtils.directoryContains() and FileUtils.directoryContains() return wrong result when parent and child have the same path prefix
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IO-727
>                 URL: https://issues.apache.org/jira/browse/IO-727
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>            Reporter: Trung Pham
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> FilenameUtils.directoryContains() and FileUtils.directoryContains() will return `true` with the following input.
> {code:java}
> canonicalParent: /path/foo
> canonicalChild:  /path/foobar
> {code}
> There were several issues on this but the problem still remains.
>  IO-423 didn't do anything.
>  IO-466 test case added in [676c03|https://github.com/apache/commons-io/commit/67325cf97946f053da51dd358a9ffca0a9676c03] just happened to passed because the input file didn't exist.
> I'll try to make a PR with tests to demonstrate the bug.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)