gnodet opened a new pull request, #30283:
URL: https://github.com/apache/camel/pull/30283
## Summary
When a Kamelet (or any endpoint URI) uses an optional property placeholder
(`{{?name}})` for one parameter and the property is not set, the remaining
parameters in the query string get their values URL-encoded, corrupting them.
Parameter values containing URL-special characters — colons, slashes, question
marks, equals signs — are the most visibly affected (e.g. a URL value
`http://host/path?q=v` becomes `http%3A%2F%2Fhost%2Fpath%3Fq%3Dv`).
## Root Cause
`EndpointHelper.doResolveEndpointUriOptionalPropertyPlaceholders()` rebuilds
the query string in two steps:
1. `URISupport.parseQuery(query)` — URL-**decodes** parameter values
(default mode)
2. `URISupport.createQueryString(keep)` — URL-**encodes** parameter values
(default mode)
For values that are already in raw (unencoded) form, the decode→reencode
round-trip introduces spurious percent-encoding.
## Fix
Use `URISupport.parseQuery(query, true)` (raw mode — no URL-decoding)
together with `URISupport.createQueryString(keep, false)` (no URL-encoding) so
the original raw query values are preserved as-is after the optional
placeholder entries are removed.
## Tests
Added `testOptionalPlaceholderDoesNotUrlEncodeOtherParams` to
`PropertiesComponentIgnoreMissingPropertyTest`. The test:
- Confirms that a URI like
`kamelet:http-sink?url=http://127.0.0.1:18089/open/with?q=status_s:new&foo={{?nosuchproperty}}`
resolves to
`kamelet:http-sink?url=http://127.0.0.1:18089/open/with?q=status_s:new` (the
URL value is preserved verbatim, not percent-encoded)
- Verified **RED** on the unfixed code (output:
`url=http%3A%2F%2F127.0.0.1%3A18089%2Fopen%2Fwith%3Fq%3Dstatus_s%3Anew`)
- Verified **GREEN** on the fix
Fixes CAMEL-27111
---
_Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]