#60 Issue with ChannelSftp.remoteAbsolutePath on Windows

open
nobody
None
5
2013-05-13
2013-05-13
No

Hi,

We use jsch version 0.1.49 in our application to connect to sftp servers. Now an external consultant who is running Windows is having problems running one of my (junit) tests.

The problem seems to be in the method called remoteAbsolutePath in class ChannelSftp, starting on line 2698. The method is supposed to return the absolute path for the given path (absolute or relative). The method tries to auto detect if it's already an absolute path by checking if the first character is a forward slash(/), but of course this causes problems on Windows:

if(path.charAt(0)=='/') return path;

Consider the following statement in class ChannelSftp, line 1485:
path=remoteAbsolutePath(path);

Before this statement is executed, path has a value of "C:\projects\app\sftp\path\to\sftp-root", but the remoteAbsolutePath then returns "/C:/projects/app/C:\projects\app\sftp\path\to\sftp-root" which is obviously wrong.

I have downloaded the source for 0.1.50, but the bug is still there (though remoteAbsolutePath is now found on line 2908).

I have been trying to find a public repository for jsch to contribute a fix to this bug, but have not been able to find anything. Is there a public repo somewhere?

Discussion


Log in to post a comment.