Fixed handling of simple file name 'get' argument for interactive SFTP command
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/6a8253d6 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/6a8253d6 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/6a8253d6 Branch: refs/heads/master Commit: 6a8253d62a1e0bdaf1cf6482c61626316ad75abf Parents: af4561a Author: Lyor Goldstein <[email protected]> Authored: Thu Jan 21 15:06:19 2016 +0200 Committer: Lyor Goldstein <[email protected]> Committed: Thu Jan 21 15:06:19 2016 +0200 ---------------------------------------------------------------------- .../org/apache/sshd/client/subsystem/sftp/SftpCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/6a8253d6/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpCommand.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpCommand.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpCommand.java index ab28f9a..82b021d 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpCommand.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpCommand.java @@ -763,6 +763,12 @@ public class SftpCommand implements Channel { transferRemoteDir(sftp, local, remote, attrs, stdout, verbose); } } else { + if (Files.exists(local) && Files.isDirectory(local)) { + int pos = remote.lastIndexOf('/'); + String name = (pos >= 0) ? remote.substring(pos + 1) : remote; + local = local.resolve(name); + } + transferFile(sftp, local, remote, upload, stdout, verbose); } }
