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 2020/01/11 15:11:37 UTC
[camel] branch master updated: CAMEL-14372: Fixed file util to not
compact http url
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 2777b6c CAMEL-14372: Fixed file util to not compact http url
2777b6c is described below
commit 2777b6c1bb9eab5d7f8ce6bb4a9914e097dff09d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 11 16:07:41 2020 +0100
CAMEL-14372: Fixed file util to not compact http url
---
.../src/test/java/org/apache/camel/util/FileUtilTest.java | 7 +++++++
core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java | 6 +++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java b/core/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
index 7326efe..b022270 100644
--- a/core/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java
@@ -261,4 +261,11 @@ public class FileUtilTest extends Assert {
assertTrue("File not copied", target.exists());
assertFalse("File not deleted", file.exists());
}
+
+ @Test
+ public void testCompactHttpPath() {
+ String in = "http://foo.com/apps/func/schemas/part/myap/dummy-schema.xsd";
+ String out = FileUtil.compactPath(in, "/");
+ assertEquals(in, out);
+ }
}
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java b/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
index 1bb3015..84d841c 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
@@ -272,13 +272,17 @@ public final class FileUtil {
}
/**
- * Compacts a path by stacking it and reducing <tt>..</tt>,
+ * Compacts a file path by stacking it and reducing <tt>..</tt>,
* and uses the given separator.
*/
public static String compactPath(String path, String separator) {
if (path == null) {
return null;
}
+
+ if (path.startsWith("http:")) {
+ return path;
+ }
// only normalize if contains a path separator
if (path.indexOf('/') == -1 && path.indexOf('\\') == -1) {