You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by on...@apache.org on 2018/12/20 10:48:07 UTC
[camel] branch camel-2.x updated: CAMEL-13017 - handle root path on
windows
This is an automated email from the ASF dual-hosted git repository.
onders pushed a commit to branch camel-2.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.x by this push:
new 3d92c7d CAMEL-13017 - handle root path on windows
3d92c7d is described below
commit 3d92c7d1e6ef305b062dd556402ec25a45c5fdc9
Author: onders <on...@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 834595a..ecdc583 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);
+ }
}
}