Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 25306ca

Browse files
authored
Fix put in folder (#54)
1 parent f2491a0 commit 25306ca

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

GeneXusSftp/src/main/java/com/genexus/sftp/SftpClient.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ public boolean put(String localPath, String remoteDir) {
7272
this.error.setError("SF005", "The channel is invalid, reconect");
7373
return false;
7474
}
75-
if (SecurityUtils.compareStrings(remoteDir, "/") || SecurityUtils.compareStrings(remoteDir, "\\")) {
76-
String dirRemote = this.getWorkingDirectory();
77-
if (dirRemote.contains("\\")) {
78-
remoteDir = SecurityUtils.compareStrings(dirRemote, "\\") ? dirRemote : dirRemote + "\\";
79-
} else {
80-
remoteDir = SecurityUtils.compareStrings(dirRemote, "/") ? dirRemote : dirRemote + "/";
75+
76+
if(remoteDir.length() > 1) {
77+
if(remoteDir.startsWith("\\") || remoteDir.startsWith("/"))
78+
{
79+
remoteDir = remoteDir.substring(1, remoteDir.length());
8180
}
82-
}
83-
remoteDir += getFileName(localPath);
81+
}
8482
try {
8583
this.channel.put(localPath, remoteDir);
8684
} catch (SftpException e) {

0 commit comments

Comments
 (0)