Copilot commented on code in PR #6951:
URL: https://github.com/apache/shenyu/pull/6951#discussion_r4038343956


##########
shenyu-plugin/shenyu-plugin-rewrite/src/main/java/org/apache/shenyu/plugin/rewrite/RewritePlugin.java:
##########
@@ -76,7 +76,7 @@ protected Mono<Void> doExecute(final ServerWebExchange 
exchange, final ShenyuPlu
                 && ThreadLocalRandom.current().nextInt(100) < percentage) {
             rewriteUri = rewriteHandle.getReplace().contains("{") && 
rewriteHandle.getRegex().contains("{")

Review Comment:
   This still misclassifies valid Java regex quantifiers as path placeholders. 
`RewriteHandle.regex` is documented as a Java regular expression; with regex 
`/shenyu/[0-9]{3}`, replacement `/new/{id}`, and URI `/shenyu/123`, both 
`contains` checks pass, but the `{` index is 13 while the URI length is 11, so 
`substring(13)` still throws and returns a 500. Detect an actual/shared 
path-variable token rather than any opening brace, and cover a quantified-regex 
case.



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