Menu

#33 Bad FTPFile paths in getDirectoryListing(String)

open
nobody
None
5
2016-02-25
2011-06-28
No

When calling getDirectoryListing(aDirectory), where <i>aDirectory</i> is a subdirectory of the working directory, the FTPFile's full paths are wrong. They all point to the working directory instead of the expected directory although the name list is the one of <i>aDirectory</i>.
In getDirectoryListing(String) source code, getWorkingDirectory() is always used to provide the path. I modified both getDirectoryListing() methods to get the execution and the full paths of the returned FTPFile list correct in both cases. You can find my code attached.
Thanks in advance for taking in into account.

Discussion

  • Jeff GUILLAUD

    Jeff GUILLAUD - 2011-06-28

    Correction proposition

     
  • warri

    warri - 2011-07-23

    Hello, I noticed the same behavior, but your code still produces wrong paths.

    Example:

    Work directory: /a/b/
    call getDirectoryListing(path), path = a/b/c
    -> produces a path like /a/b//a/b/c

    Workaround from the original code is to change directory first, and then to call getDirectoryListing() with no arguments.

    A fix could be easy to do, maybe I will have a closer look into it later.

     
  • Arnold Maderthaner

    could you provide a proper patch please ?

     

Log in to post a comment.