Claus Ibsen created CAMEL-27111:
-----------------------------------
Summary: camel-kamelet - an unset optional placeholder among the
Kamelet parameters makes the other parameters URL-encoded
Key: CAMEL-27111
URL: https://issues.apache.org/jira/browse/CAMEL-27111
Project: Camel
Issue Type: Bug
Components: camel-kamelet
Reporter: Claus Ibsen
When a route passes parameters to a Kamelet and one of them is an optional
property placeholder that is not set ({{?name}}), the other parameters reach
the Kamelet URL-encoded. A Kamelet that uses such a value as an endpoint URI
then fails to start.
*Reproducer* (Camel JBang 4.24.0-SNAPSHOT, the http-sink Kamelet of
camel-kamelets):
{code:yaml}
- route:
from:
uri: timer:b?repeatCount=1
steps:
- setBody: {constant: {expression: "x"}}
- to:
uri: kamelet:http-sink
parameters:
url: "http://127.0.0.1:18089/open/with?q=status_s:new"
foo: "{{?nosuchproperty}}"
{code}
The Kamelet does not start:
{noformat}
Failed to create route: http-sink-2 at: >>> to[{{url}}] <<< ... because: Failed
to resolve endpoint:
http%3A%2F%2F127.0.0.1%3A18089%2Fopen%2Fwith%3Fq%3Dstatus_s%3Anew due to:
Cannot auto create component:
http%3A%2F%2F127.0.0.1%3A18089%2Fopen%2Fwith%3Fq%3Dstatus_s%3Anew
{noformat}
* Without the foo line, the same route works, and the request reaches the
server as POST /open/without?q=status_s%3Anew.
* With foo: "" (a literal empty value) instead of the unset placeholder, it
also works.
So the trigger is an unset optional placeholder among the Kamelet parameters:
the other values then get encoded once more.
Other symptoms of the same problem, seen in camel-kamelets:
* solr-source: the query status_s:new reaches Solr as status_s%3Anew and finds
nothing, when another parameter of the same kamelet: call is an unset {{?x}}.
* A password with special characters, passed through a placeholder, is mangled
in the same situation; wrapping it in RAW() avoids it.
Related, but a different case: CAMEL-25453 (an encoded & in an option value
splits the option).
Found while working on the camel-kamelets catalog (apache/camel-kamelets#3170).
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)