shashank created CAMEL-26420:
--------------------------------

             Summary: camel-core - Simple: the white space around an argument 
of join is part of it
                 Key: CAMEL-26420
                 URL: https://issues.apache.org/jira/browse/CAMEL-26420
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: shashank
            Assignee: shashank


Follow-up of CAMEL-26312 (apache/camel#28715), asked for in its review.

{{JoinFunctionFactory}} splits the arguments of 
{{${join(separator,prefix,exp)}}} with 
{{StringQuoteHelper.splitSafeQuote(values, ',', false)}}, which keeps the white 
space around a value, also outside its quotes. A space after the comma becomes 
part of the next argument:

{noformat}
body: [A, B, C]
${join(&,id=)}                 -> id=A&id=B&id=C
${join(&, id=)}                -> " id=A& id=B& id=C"   (the prefix is " id=")
${join(&, id=, ${header.ids})} -> the expression is " ${header.ids}"
{noformat}

CAMEL-24969 (4.23.0) fixed the same split for the collection functions, and 
CAMEL-26312 for {{replace}}, {{substring}}, {{substringBefore}}, 
{{substringAfter}}, {{substringBetween}} and {{contains}}, with the shared 
{{SimpleFunctionHelper.splitArguments}} helper. {{join}} was left out of 
CAMEL-26312 on purpose, because its separator can be white space on purpose: 
{{${join(; ,'')}}} gives {{A; B; C}} today (separator {{"; "}}); with 
{{splitArguments}} it becomes {{A;B;C}} and the separator has to be quoted.

Options:
* (a) use {{splitArguments}} for all three arguments, document that a separator 
with spaces is quoted, with an upgrade-guide entry;
* (b) use {{splitArguments}} for the prefix and the expression only, and keep 
the separator as written.

Tests: {{${join(&, id=)}}} gives {{id=A&id=B&id=C}}; a nested expression after 
a space; a quoted separator with spaces; the documented examples in 
simple-functions.adoc unchanged.

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to