You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Barry Kelly (JIRA)" <ji...@apache.org> on 2013/04/09 12:46:17 UTC

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

Barry Kelly created CAMEL-6254:
----------------------------------

             Summary: 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
         Environment: Linux, OpenSSH sftp
            Reporter: Barry Kelly


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