qicz commented on a change in pull request #2738:
URL: https://github.com/apache/incubator-shenyu/pull/2738#discussion_r780784899
##########
File path:
shenyu-plugin/shenyu-plugin-uri/src/main/java/org/apache/shenyu/plugin/uri/URIPlugin.java
##########
@@ -42,27 +42,18 @@
if (StringUtils.isBlank(path)) {
return chain.execute(exchange);
}
- String rewriteURI = (String)
exchange.getAttributes().get(Constants.REWRITE_URI);
+ String rewriteUri = (String)
exchange.getAttributes().get(Constants.REWRITE_URI);
URI uri = exchange.getRequest().getURI();
- if (StringUtils.isNoneBlank(rewriteURI)) {
- path = path + rewriteURI;
+ if (StringUtils.isNoneBlank(rewriteUri)) {
+ path = path + rewriteUri;
} else {
String realUrl = shenyuContext.getRealUrl();
if (StringUtils.isNoneBlank(realUrl)) {
path = path + realUrl;
}
}
- URI realURI;
- if (StringUtils.isNotEmpty(uri.getRawQuery()) &&
uri.getRawQuery().contains("%")) {
- path = String.join("?", path, uri.getRawQuery());
- realURI =
UriComponentsBuilder.fromHttpUrl(path).build(true).toUri();
- } else {
- if (StringUtils.isNotEmpty(uri.getQuery())) {
- path = String.join("?", path, uri.getQuery());
- }
- realURI =
UriComponentsBuilder.fromHttpUrl(path).build(false).toUri();
- }
- exchange.getAttributes().put(Constants.HTTP_URI, realURI);
+ URI realUri = URI.create(path + "?" +
RequestQueryCodecUtil.getCodecQuery(exchange));
Review comment:
some query like `status=[abc%2Cedf]` will catch the `Invalid character
'[' for QUERY_PARAM in status=[abc%2Cedf]`
--
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]