You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2015/02/28 15:01:50 UTC

mina-sshd git commit: [SSHD-422] Take into account local file separator when converting to/from SFTP paths

Repository: mina-sshd
Updated Branches:
  refs/heads/0.14.x 3ae206314 -> 1804661e6


[SSHD-422] Take into account local file separator when converting to/from SFTP paths


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/1804661e
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/1804661e
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/1804661e

Branch: refs/heads/0.14.x
Commit: 1804661e6b334eb63e5c158f8f5e7f761bd45db5
Parents: 3ae2063
Author: Guillaume Nodet <gn...@apache.org>
Authored: Sat Feb 28 14:24:42 2015 +0100
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Sat Feb 28 15:01:41 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/sshd/server/sftp/SftpSubsystem.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1804661e/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
index 07c4b20..281fb7d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
@@ -21,6 +21,7 @@ package org.apache.sshd.server.sftp;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.EOFException;
+import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -934,8 +935,12 @@ public class SftpSubsystem implements Command, Runnable, SessionAware, FileSyste
         buffer.putByte((byte) SSH_FXP_NAME);
         buffer.putInt(id);
         buffer.putInt(1);
+
+        String originalPath = f.getAbsolutePath();
+        //in case we are running on Windows
+        String unixPath = originalPath.replace(File.separatorChar, '/');
         //normalize the given path, use *nix style separator
-        String normalizedPath = SelectorUtils.normalizePath(f.getAbsolutePath(), "/");
+        String normalizedPath = SelectorUtils.normalizePath(unixPath, "/");
         if (normalizedPath.length() == 0) {
             normalizedPath = "/";
         }