Sean-Walker0 opened a new pull request, #7492:
URL: https://github.com/apache/shenyu/pull/7492

   Fixes #7464
   
   ## Modifications
   
   `RequestParamParameterProcessor` appended parameter keys and values into the 
URL verbatim (`urlResult.append(key).append("=").append(value)`), so reserved 
characters were interpreted as URL syntax instead of parameter data — a value 
like `a&admin=true` turned one logical parameter into two, and spaces, `=` or 
`%` could produce malformed or differently parsed URLs on the gateway/upstream 
side.
   
   Both the key and the value are now encoded before appending:
   
   ```java
   urlResult.append(UriUtils.encodeQueryParam(String.valueOf(key), 
StandardCharsets.UTF_8))
           .append('=')
           .append(UriUtils.encodeQueryParam(String.valueOf(value), 
StandardCharsets.UTF_8));
   ```
   
   Plain alphanumeric values are byte-for-byte unchanged; the map-valued 
`@RequestParam` branch is covered too.
   
   ## Verifying this change
   
   - [x] New `processArgumentEncodesReservedCharactersTest` — `q = 
"a&admin=true 100%"` must produce `q=a%26admin%3Dtrue%20100%25`. Red on the 
pre-fix code (`?q=a&admin=true 100%` was appended raw), green after.
   - [x] New `processArgumentMapValuesAreEncodedTest` — reserved characters in 
map keys and values are encoded.
   - [x] All pre-existing value cases (`id=idValue`, `id=32`, …) unchanged — 
37/37 module tests green (4 pre-existing skips), checkstyle clean: `./mvnw -pl 
shenyu-sdk/shenyu-sdk-spring -am test -B`.
   
   ## Notes
   
   - Behavior change: only for parameters containing reserved/non-ASCII 
characters — they are now sent percent-encoded instead of raw; 
standards-compliant clients and servers treat the encoded form as equivalent.
   - Orthogonality: no open PR modifies `shenyu-sdk-spring` (#7445 touches only 
`shenyu-sdk-httpclient`). This change and #7465 (annotation name aliases, PR 
#7491) touch different regions of the same file — the name resolution at the 
method head vs. the append loop — so they merge cleanly in either order.
   
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true` (module-scoped: `shenyu-sdk/shenyu-sdk-spring` with 
`-am`, tests + checkstyle green).


-- 
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]

Reply via email to