You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/06/21 12:29:29 UTC
[camel] 02/02: CAMEL-13667
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit cd8ddf44572c33254ff0a272e30a370d3b00d129
Author: cblamauer <52...@users.noreply.github.com>
AuthorDate: Thu Jun 20 17:43:14 2019 +0200
CAMEL-13667
Windows network UNC paths not treated correctly (File2/tempPrefix) test
---
core/camel-core/src/test/java/org/apache/camel/util/FileUtilTest.java | 4 ++++
1 file changed, 4 insertions(+)
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 2c2388a..089c235 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
@@ -168,6 +168,8 @@ public class FileUtilTest extends Assert {
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"));
+ // Test that multiple back-slashes at the beginning are preserved, this is necessary for network UNC paths.
+ assertEquals("\\\\foo\\bar\\baz", FileUtil.compactPath("\\\\foo\\bar\\baz"));
assertEquals("\\", FileUtil.compactPath("\\"));
assertEquals("\\", FileUtil.compactPath("/"));
assertEquals("/", FileUtil.compactPath("\\", '/'));
@@ -187,6 +189,8 @@ public class FileUtilTest extends Assert {
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"));
+ // Do not preserve multiple slashes at the beginning if not on Windows.
+ assertEquals("/foo/bar/baz", FileUtil.compactPath("//foo/bar/baz"));
assertEquals("/", FileUtil.compactPath("/"));
assertEquals("/", FileUtil.compactPath("\\"));
assertEquals("/", FileUtil.compactPath("/", '/'));