[ 
https://issues.apache.org/jira/browse/CAMEL-13017?focusedWorklogId=177385&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-177385
 ]

ASF GitHub Bot logged work on CAMEL-13017:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Dec/18 09:08
            Start Date: 20/Dec/18 09:08
    Worklog Time Spent: 10m 
      Work Description: onderson closed pull request #2679: CAMEL-13017 - 
handle root path on windows
URL: https://github.com/apache/camel/pull/2679
 
 
   

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 1ecce010b46..5f75910641a 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
@@ -618,12 +618,17 @@ public synchronized void changeCurrentDirectory(String 
path) throws GenericFileO
         // that
         if (FileUtil.hasLeadingSeparator(path)) {
             // change to root path
-            if (!FileUtil.isWindows()) {
+            if (!path.matches("^[a-zA-Z]:(//|\\\\).*$")) {
                 doChangeDirectory(path.substring(0, 1));
                 path = path.substring(1);
             } else {
-                doChangeDirectory(path.substring(0, 4));
-                path = path.substring(4);
+                if(path.matches("^[a-zA-Z]:(//).*$")) {
+                    doChangeDirectory(path.substring(0, 3));
+                    path = path.substring(3);
+                } else if(path.matches("^[a-zA-Z]:(\\\\).*$")) {
+                    doChangeDirectory(path.substring(0, 4));
+                    path = path.substring(4);
+                }
             }
         }
 


 

----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 177385)
    Time Spent: 20m  (was: 10m)

> root-Path handling for SFTP on windows bug
> ------------------------------------------
>
>                 Key: CAMEL-13017
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13017
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.23.0
>         Environment: 2.23.0 / executing on windows jdk8 / remote sftp server 
> linux
>  
>            Reporter: Jens Kleemann
>            Assignee: Önder Sezgin
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> In SftpOperations.java the commit 0d3612672f2927d0428c2b79686759c16be88791
> has introduced a remoting bug when running on windows and connecting to sftp 
> server.
> If the sfpt/camel is running on windows, then it assumes that the path 
> include a "root-path" like "C://" which is not necessarily true for sftp 
> connections. 
> So instead of "/" it creates a root path of "/hom" when working with an sftp 
> path like "/home/jkleemann/transfer/....:" and fails when trying to change 
> directory to this root path.
> see 
> [https://github.com/apache/camel/commit/0d3612672f2927d0428c2b79686759c16be88791]
> for the changes
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to