This is an automated email from the ASF dual-hosted git repository.

onders pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 712edf6  CAMEL-13017 - handle root path on windows
712edf6 is described below

commit 712edf6dc143b227e4947b7cec11c735532508a8
Author: onders <ond...@apache.org>
AuthorDate: Thu Dec 20 01:15:39 2018 +0300

    CAMEL-13017 - handle root path on windows
---
 .../apache/camel/component/file/remote/SftpOperations.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

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 1ecce01..5f75910 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 class SftpOperations implements 
RemoteFileOperations<SftpRemoteFile> {
         // 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);
+                }
             }
         }
 

Reply via email to