[ 
https://issues.apache.org/jira/browse/CAMEL-11387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222601#comment-16222601
 ] 

ASF GitHub Bot commented on CAMEL-11387:
----------------------------------------

onders86 closed pull request #2066: CAMEL-11387 - adjust destination filename 
by calling existing method …
URL: https://github.com/apache/camel/pull/2066
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
index 1721c40da12..84d427f875c 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
@@ -447,6 +447,9 @@ public synchronized boolean renameFile(String from, String 
to) throws GenericFil
         LOG.debug("Renaming file: {} to: {}", from, to);
         try {
             reconnectIfNecessary();
+            //make use of the '/' separator because JSch expects this 
+            // as the file separator even on Windows
+            to = FileUtil.compactPath(to, '/');
             channel.rename(from, to);
             return true;
         } catch (SftpException e) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> SFTP is delivered into incorrect location, without exception (file in 
> subfolder + temp file is created + Camel running on Window & SFTP server 
> running on LINUX)
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-11387
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11387
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sftp
>    Affects Versions: 2.19.0
>         Environment: camel is running on Window, and SFTP server is LINUX
>            Reporter: Cherry Ngai
>            Assignee: Önder Sezgin
>            Priority: Minor
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> The bug only happens when:
> i) file in subfolder
> ii) temp file is created 
> iii) Camel running on Window & SFTP server running on LINUX
> Route Configuration:
> {code}
>  from("file://sourceFolder?recursive=true&delay=60000").
>  to("sftp://username@linuxServer?tempFileName=${file:onlyname}.part";);
> {code}
> NOTES: added separator=UNIX or AUTO, I got the same issue.
> Window Local File: sourceFolder/myfolder1/myfolder2/test.txt
> FTPS Remote File Delivered: $linuxServer/myfolder1myfolder2test.txt
> NOTES: 
> * There is no exception throw in 2.19.0, even though the file delivered into 
> incorrect location.  
> * In 2.17.3, exception throw at 
> org.apache.camel.component.file.remote.SftpOperations.renameFile(SftpOperations.java:431)[camel-ftp-2.17.3.jar:2.17.3]
> * Without tempFileName, it works perfectly.  Issue is around the rename area.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to