camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1458910 - /camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
Date Wed, 20 Mar 2013 16:06:36 GMT
Author: davsclaus
Date: Wed Mar 20 16:06:36 2013
New Revision: 1458910

URL: http://svn.apache.org/r1458910
Log:
CAMEL-6056: Avoid double slashes in path names for camel-ftp.

Modified:
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java?rev=1458910&r1=1458909&r2=1458910&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
(original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
Wed Mar 20 16:06:36 2013
@@ -91,6 +91,17 @@ public final class FtpUtils {
             sb.append(File.separator);
         }
 
+        // there has been problems with double slashes,
+        // so avoid this by removing any 2nd slash
+        if (sb.length() >= 2) {
+            boolean firstSlash = sb.charAt(0) == '/' || sb.charAt(0) == '\\';
+            boolean secondSlash = sb.charAt(1) == '/' || sb.charAt(1) == '\\';
+            if (firstSlash && secondSlash) {
+                // remove 2nd clash
+                sb = sb.replace(1, 2, "");
+            }
+        }
+
         return sb.toString();
     }
 



Mime
View raw message