You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2013/08/23 09:55:54 UTC

[jira] [Resolved] (CAMEL-6254) Sftp changeCurrentDirectory doesn't work for some combinations of state

     [ https://issues.apache.org/jira/browse/CAMEL-6254?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-6254.
--------------------------------

    Resolution: Duplicate
      Assignee: Claus Ibsen

CAMEL-6335 fixes this
                
> Sftp changeCurrentDirectory doesn't work for some combinations of state
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-6254
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6254
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.10.4, 2.10.5
>         Environment: Linux, OpenSSH sftp
>            Reporter: Barry Kelly
>            Assignee: Claus Ibsen
>
> The changeCurrentDirectory function in SftpOperations doesn't work correctly for certain combinations of state. It appears as a failure to change directory, to some directory with the first letter missing; e.g. failed to chdir to 'ploads', when current directory is '/uploads' and target directory is '/'.
> The code can't work:
>         if (getCurrentDirectory().startsWith(path)) {
>             // use relative path
>             String p = getCurrentDirectory().substring(path.length());
>             if (p.length() == 0) {
>                 return;
>             }
>             // the first character must be '/' and hence removed
>             path = UP_DIR_PATTERN.matcher(p).replaceAll("/..").substring(1);
>         }
> If getCurrentDirectory() is "/uploads", and path is "/", following this logic through, path will end up as "ploads". This fails later.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira