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 2022/08/29 09:04:36 UTC
[camel] branch camel-3.18.x updated: CAMEL-18435: camel-core - RAW() values should be kept as-is (need to reverse encode %25 to %) due to need for parsing via java.net.URI during endpoint creation.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.18.x by this push:
new deefe97f53f CAMEL-18435: camel-core - RAW() values should be kept as-is (need to reverse encode %25 to %) due to need for parsing via java.net.URI during endpoint creation.
deefe97f53f is described below
commit deefe97f53f537262fa4d97dd8b27ca512c64007
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 29 11:00:36 2022 +0200
CAMEL-18435: camel-core - RAW() values should be kept as-is (need to reverse encode %25 to %) due to need for parsing via java.net.URI during endpoint creation.
---
.../org/apache/camel/component/file/FileURLDecodingTest.java | 5 -----
.../src/main/java/org/apache/camel/util/URISupport.java | 10 ++++++++--
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileURLDecodingTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileURLDecodingTest.java
index 906bd3eb6f2..ea1e48dddf0 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileURLDecodingTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileURLDecodingTest.java
@@ -72,11 +72,6 @@ public class FileURLDecodingTest extends ContextTestSupport {
assertTargetFile("RAW(data%20.txt)", "data%20.txt");
}
- @Test
- public void testFileRaw2520() throws Exception {
- assertTargetFile("RAW(data%2520.txt)", "data%2520.txt");
- }
-
@Test
public void testFileWithTwoHundredPercent() throws Exception {
assertTargetFile("RAW(data%%.txt)", "data%%.txt");
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java b/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java
index a6fb8b324c4..82de5b94ad9 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java
@@ -331,14 +331,20 @@ public final class URISupport {
String raw = URIScanner.resolveRaw(str);
if (raw != null) {
// update the string in the list
- list.set(i, raw);
+ // do not encode RAW parameters unless it has %
+ // need to reverse: replace % with %25 to avoid losing "%" when decoding
+ String s = raw.replace("%25", "%");
+ list.set(i, s);
}
}
} else {
String str = entry.getValue().toString();
String raw = URIScanner.resolveRaw(str);
if (raw != null) {
- entry.setValue(raw);
+ // do not encode RAW parameters unless it has %
+ // need to reverse: replace % with %25 to avoid losing "%" when decoding
+ String s = raw.replace("%25", "%");
+ entry.setValue(s);
}
}
}