You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2021/11/02 09:44:55 UTC
[incubator-shenyu] branch master updated: [type: refactor] fix uri
plugin bug. (#2295)
This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 845ad6e [type: refactor] fix uri plugin bug. (#2295)
845ad6e is described below
commit 845ad6efc35f9656bad68603f160e10edb8995b1
Author: Qicz <qi...@gmail.com>
AuthorDate: Tue Nov 2 17:44:45 2021 +0800
[type: refactor] fix uri plugin bug. (#2295)
* [type: refactor] fix uri plugin bug.
* optimize
---
.../src/main/java/org/apache/shenyu/plugin/uri/URIPlugin.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/shenyu-plugin/shenyu-plugin-uri/src/main/java/org/apache/shenyu/plugin/uri/URIPlugin.java b/shenyu-plugin/shenyu-plugin-uri/src/main/java/org/apache/shenyu/plugin/uri/URIPlugin.java
index f6e81c9..4352ffd 100644
--- a/shenyu-plugin/shenyu-plugin-uri/src/main/java/org/apache/shenyu/plugin/uri/URIPlugin.java
+++ b/shenyu-plugin/shenyu-plugin-uri/src/main/java/org/apache/shenyu/plugin/uri/URIPlugin.java
@@ -41,6 +41,9 @@ public class URIPlugin implements ShenyuPlugin {
ShenyuContext shenyuContext = exchange.getAttribute(Constants.CONTEXT);
assert shenyuContext != null;
String path = exchange.getAttribute(Constants.HTTP_DOMAIN);
+ if (StringUtils.isBlank(path)) {
+ return chain.execute(exchange);
+ }
String rewriteURI = (String) exchange.getAttributes().get(Constants.REWRITE_URI);
URI uri = exchange.getRequest().getURI();
if (StringUtils.isNoneBlank(rewriteURI)) {
@@ -59,7 +62,6 @@ public class URIPlugin implements ShenyuPlugin {
if (StringUtils.isNotEmpty(uri.getQuery())) {
path = path + "?" + uri.getQuery();
}
- assert path != null;
realURI = UriComponentsBuilder.fromHttpUrl(path).build(false).toUri();
}
exchange.getAttributes().put(Constants.HTTP_URI, realURI);