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

Gerrit Telkamp updated SSHD-298:
--------------------------------

    Description: 
When I try to copy a file using ScpClient.upload() to a remote machine using an 
absolute path that begins with a drive letter, the copy operation will fail:

Exception in thread "main" java.io.IOException: Received nack: Can not write to 
/C:/Workspace/SSHTest/bin/C:/DOKUME~1/AUTOBU~1/LOKALE~1/Temp/testfile.txt
(the current working directory was C:\Workspace\SSHTest\bin)

When I use an absolute path that does not begin with a drive letter (e.g. 
"\DOKUME~1\AUTOBU~1\LOKALE~1\Temp\testfile.txt) the copy operation works.

It seems that the windows client does not recognize paths beginning with a 
drive letter as absolute, so it assums a relative path and eppends it to the 
current directory (C:\Workspace\SSHTest\bin in this case).

Below a piece of testcode:

private ScpClient m_scp;
private String srcFile = "testfile.txt";
private String dstFile = "C:\\DOKUME~1\\AUTOBU~1\\LOKALE~1\\Temp\\testfile.txt";

m_scp = m_session.createScpClient();
m_scp.upload(srcFile, dstFile);


  was:
When I try to copy a file using ScpClient.upload() to a remote machine using an 
absolute path that begins with a drive letter, the copy operation will fail:

Exception in thread "main" java.io.IOException: Received nack: Can not write to 
/C:/Workspace/SSHTest/bin/C:/DOKUME~1/AUTOBU~1/LOKALE~1/Temp/testfile.txt
(the current working directory was C:\Workspace\SSHTest\bin)

When I use an absolute path that does not begin with a drive letter (e.g. 
"\/DOKUME~1\AUTOBU~1\LOKALE~1\Temp\testfile.txt) the copy operation works.

It seems that the windows client does not recognize paths beginning with a 
drive letter as absolute, so it copies it to the current directory.

Below a piece of testcode:

private ScpClient m_scp;
private String srcFile = "testfile.txt";
private String dstFile = "C:\\DOKUME~1\\AUTOBU~1\\LOKALE~1\\Temp\\testfile.txt";

m_scp = m_session.createScpClient();
m_scp.upload(srcFile, dstFile);



> Windows: ScpClient.upload fails on remote machine if path is absolute and 
> begins with a drive letter
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SSHD-298
>                 URL: https://issues.apache.org/jira/browse/SSHD-298
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.10.1
>         Environment: Windows
>            Reporter: Gerrit Telkamp
>
> When I try to copy a file using ScpClient.upload() to a remote machine using 
> an absolute path that begins with a drive letter, the copy operation will 
> fail:
> Exception in thread "main" java.io.IOException: Received nack: Can not write 
> to /C:/Workspace/SSHTest/bin/C:/DOKUME~1/AUTOBU~1/LOKALE~1/Temp/testfile.txt
> (the current working directory was C:\Workspace\SSHTest\bin)
> When I use an absolute path that does not begin with a drive letter (e.g. 
> "\DOKUME~1\AUTOBU~1\LOKALE~1\Temp\testfile.txt) the copy operation works.
> It seems that the windows client does not recognize paths beginning with a 
> drive letter as absolute, so it assums a relative path and eppends it to the 
> current directory (C:\Workspace\SSHTest\bin in this case).
> Below a piece of testcode:
> private ScpClient m_scp;
> private String srcFile = "testfile.txt";
> private String dstFile = 
> "C:\\DOKUME~1\\AUTOBU~1\\LOKALE~1\\Temp\\testfile.txt";
> m_scp = m_session.createScpClient();
> m_scp.upload(srcFile, dstFile);



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to