mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-03 03:59:07 +08:00
solve the issue that ftpwriter is unable to write file to root path e.g. /test.txt
This commit is contained in:
parent
33e6ace661
commit
132a37475a
@ -195,8 +195,7 @@ public class SftpHelperImpl implements IFtpHelper {
|
|||||||
public OutputStream getOutputStream(String filePath) {
|
public OutputStream getOutputStream(String filePath) {
|
||||||
try {
|
try {
|
||||||
this.printWorkingDirectory();
|
this.printWorkingDirectory();
|
||||||
String parentDir = filePath.substring(0,
|
String parentDir = FilenameUtils.getFullPathNoEndSeparator(filePath);
|
||||||
StringUtils.lastIndexOf(filePath, IOUtils.DIR_SEPARATOR));
|
|
||||||
this.channelSftp.cd(parentDir);
|
this.channelSftp.cd(parentDir);
|
||||||
this.printWorkingDirectory();
|
this.printWorkingDirectory();
|
||||||
OutputStream writeOutputStream = this.channelSftp.put(filePath,
|
OutputStream writeOutputStream = this.channelSftp.put(filePath,
|
||||||
|
@ -181,8 +181,7 @@ public class StandardFtpHelperImpl implements IFtpHelper {
|
|||||||
public OutputStream getOutputStream(String filePath) {
|
public OutputStream getOutputStream(String filePath) {
|
||||||
try {
|
try {
|
||||||
this.printWorkingDirectory();
|
this.printWorkingDirectory();
|
||||||
String parentDir = filePath.substring(0,
|
String parentDir = FilenameUtils.getFullPathNoEndSeparator(filePath);
|
||||||
StringUtils.lastIndexOf(filePath, IOUtils.DIR_SEPARATOR));
|
|
||||||
this.ftpClient.changeWorkingDirectory(parentDir);
|
this.ftpClient.changeWorkingDirectory(parentDir);
|
||||||
this.printWorkingDirectory();
|
this.printWorkingDirectory();
|
||||||
OutputStream writeOutputStream = this.ftpClient
|
OutputStream writeOutputStream = this.ftpClient
|
||||||
|
Loading…
Reference in New Issue
Block a user