camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject git commit: CAMEL-6309: Sftp upload to subdirectory does not work if home directory is root
Date Tue, 23 Jul 2013 11:41:48 GMT
Updated Branches:
  refs/heads/camel-2.10.x 0f1fc14fb -> 58d46a701


CAMEL-6309: Sftp upload to subdirectory does not work if home directory is root


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/58d46a70
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/58d46a70
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/58d46a70

Branch: refs/heads/camel-2.10.x
Commit: 58d46a70123264a71c9e9e908df98cdd2835b71c
Parents: 0f1fc14
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Tue Jul 23 13:12:22 2013 +0200
Committer: Akitoshi Yoshida <akitoshi.yoshida@sap.com>
Committed: Tue Jul 23 13:39:47 2013 +0200

----------------------------------------------------------------------
 camel-core/src/main/java/org/apache/camel/util/FileUtil.java | 2 +-
 .../src/test/java/org/apache/camel/util/FileUtilTest.java    | 8 ++++++++
 .../org/apache/camel/component/file/remote/FtpUtils.java     | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/58d46a70/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
index 001fa1b..6b26ae9 100644
--- a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
@@ -264,7 +264,7 @@ public final class FileUtil {
             }
         }
 
-        if (endsWithSlash) {
+        if (endsWithSlash && stack.size() > 0) {
             sb.append(separator);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58d46a70/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java b/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
index e9a6431..1ef3b1e 100644
--- a/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
@@ -149,6 +149,10 @@ public class FileUtilTest extends TestCase {
             assertEquals("foo\\bar\\baz", FileUtil.compactPath("foo\\bar\\.\\baz"));
             assertEquals("foo\\bar\\baz", FileUtil.compactPath("foo\\bar\\\\baz"));
             assertEquals("\\foo\\bar\\baz", FileUtil.compactPath("\\foo\\bar\\baz"));
+            assertEquals("\\", FileUtil.compactPath("\\"));
+            assertEquals("\\", FileUtil.compactPath("/"));
+            assertEquals("/", FileUtil.compactPath("\\", '/'));
+            assertEquals("/", FileUtil.compactPath("/", '/'));            
         } else {
             assertEquals("../foo", FileUtil.compactPath("../foo"));
             assertEquals("../../foo", FileUtil.compactPath("../../foo"));
@@ -164,6 +168,10 @@ public class FileUtilTest extends TestCase {
             assertEquals("foo/bar/baz", FileUtil.compactPath("foo/bar/./baz"));
             assertEquals("foo/bar/baz", FileUtil.compactPath("foo/bar//baz"));
             assertEquals("/foo/bar/baz", FileUtil.compactPath("/foo/bar/baz"));
+            assertEquals("/", FileUtil.compactPath("/"));
+            assertEquals("/", FileUtil.compactPath("\\"));
+            assertEquals("/", FileUtil.compactPath("/", '/'));
+            assertEquals("/", FileUtil.compactPath("\\", '/'));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58d46a70/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
index c4d1fb1..18cdb44 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
@@ -87,7 +87,7 @@ public final class FtpUtils {
             }
         }
 
-        if (endsWithSlash) {
+        if (endsWithSlash && stack.size() > 0) {
             sb.append(File.separator);
         }
 


Mime
View raw message