You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Bengt Rodehav (JIRA)" <ji...@apache.org> on 2013/04/24 11:35:24 UTC

[jira] [Commented] (CAMEL-6309) Sftp upload to subdirectory does not work if home directory is root ("/" or "\")

    [ https://issues.apache.org/jira/browse/CAMEL-6309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13640290#comment-13640290 ] 

Bengt Rodehav commented on CAMEL-6309:
--------------------------------------

When looking closer at the FileUtil.compactPath() method I notice that it uses the normalizePath() method which in turn does some weird checking of operating system to determine what separator to use. This functionality checks the local operating system (where Camel is running) but does not take into account what separator is being used on the remote server (the sftp server in my case).

The FileUtil class is a generic class that does not know anything about any remote file system's separator - and I don't think it should. Therefore, the FileUtil class can't really be used in SftpOperations since it makes assumptions about separators that it really can't know anything about.

I haven't encountered any erors regarding this yet but it's easy to see that the logic is failing.
                
> Sftp upload to subdirectory does not work if home directory is root ("/" or "\")
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-6309
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6309
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.10.2, 2.10.3, 2.10.4, 2.11.0
>            Reporter: Bengt Rodehav
>            Priority: Critical
>
> 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

--
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