Author: davsclaus
Date: Fri Mar 15 13:18:05 2013
New Revision: 1456944
URL: http://svn.apache.org/r1456944
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/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java?rev=1456944&r1=1456943&r2=1456944&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
Fri Mar 15 13:18:05 2013
@@ -692,8 +692,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