[ 
https://issues.apache.org/jira/browse/CAMEL-26594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-26594.
---------------------------------
    Resolution: Fixed

> camel-yaml-dsl - a value under parameters: is cut at an & when the endpoint 
> uri is created
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26594
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26594
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-yaml-dsl
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> In the YAML DSL, the parameters: of an endpoint are a map, so a value should 
> be taken as it is written. YamlSupport.createEndpointUri adds them to the uri 
> without encoding them: URISupport.createQueryString(..., false), or 
> EndpointUriFactory.buildUri(..., false) when the uri is only the scheme. Only 
> secret options are kept whole, because they are put in RAW(...).
> So a value with an & is cut at the &, and the rest becomes another option:
> {code:yaml}
> - route:
>     from:
>       uri: file:inbox
>       parameters:
>         filterFile: "${file:name} contains 'R&D'"
> {code}
> This gives file:inbox?filterFile=${file:name} contains 'R&D', and the route 
> fails to start: "Error binding property (filterFile=${file:name} contains 'R) 
> ... expected symbol singleQuote but was eol". With && in a predicate the 
> error is "Unknown parameters=[{ ${file:name} contains 'R'=}]". A lenient 
> component takes the cut value with no error: vertx-http basicAuthUsername: 
> "u&v" gives the username u.
> Values are also decoded: fileName: "a+b%20c.txt" becomes "a b c.txt".
> The workaround is to write the value in RAW(...): filterFile: 
> "RAW(${file:name} contains 'R&D')" works.
> Proposal: keep the values of parameters: whole when the uri is created, for 
> example by putting a value that has an &, + or % in RAW(...), as is done for 
> secret options. Property placeholders and bean references (#name) must keep 
> working.
> Found with the AI tools of the Camel CLI: the check of a YAML route now 
> reports such a value and suggests RAW(...) (CAMEL-26591).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to