You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/03/15 14:19:46 UTC

svn commit: r1456945 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java

Author: davsclaus
Date: Fri Mar 15 13:19:46 2013
New Revision: 1456945

URL: http://svn.apache.org/r1456945
Log:
CAMEL-6056: ftp component should use configured path separator when calculating paths during changing dir operation. Thanks to Robin Lutter for the patch.

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1456944

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java?rev=1456945&r1=1456944&r2=1456945&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java Fri Mar 15 13:19:46 2013
@@ -667,8 +667,12 @@ public abstract class GenericFileEndpoin
 
             // skip leading endpoint configured directory
             String endpointPath = getConfiguration().getDirectory() + getFileSeparator();
-            if (ObjectHelper.isNotEmpty(endpointPath) && name.startsWith(endpointPath)) {
-                name = ObjectHelper.after(name, endpointPath);
+
+            // need to normalize paths to ensure we can match using startsWith
+            endpointPath = FileUtil.normalizePath(endpointPath);
+            String copyOfName = FileUtil.normalizePath(name);
+            if (ObjectHelper.isNotEmpty(endpointPath) && copyOfName.startsWith(endpointPath)) {
+                name = name.substring(endpointPath.length());
             }
 
             // adjust filename