Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6309

Sftp upload to subdirectory does not work if home directory is root ("/" or "\")

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.10.2, 2.10.3, 2.10.4, 2.11.0
    • 2.10.7, 2.11.2, 2.12.0
    • camel-ftp
    • None
    • Unknown
    • Regression

    Description

      It is not possible to upload a file to a sub directory via sftp if the home directory (the directory where you end up directly after login) is root ("/" or "\").

      The reason is that after having checked that the sub directory exists (and perhaps created it), Camel tries to go back to the original directory which is "/". The SftpOperations.changeCurrentDirectory() method calls the FileUtil.compactPath() method that incorrecly changes "/" to "//". The bug thus resides in the FileUtil class which is part of camel-core.

      I think this bug may cause a number of other errors than the one I have enountered. E g it cannot be possible to change direcotory to "/" at all. And, other protocols (like ftp/ftps) might also be affected.

      This has been discussed on Camel user list:

      http://camel.465427.n5.nabble.com/Problems-with-sftp-in-Camel-2-11-0-td5731359.html

      Attachments

        1. FileUtil.java.patch
          0.6 kB
          Bengt Rodehav
        2. FileUtilTest.java.patch
          1 kB
          Bengt Rodehav

        Activity

          People

            ay Akitoshi Yoshida
            rodehav Bengt Rodehav
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: