moresandeep commented on code in PR #650:
URL: https://github.com/apache/knox/pull/650#discussion_r1001661250


##########
gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/GatewayDispatchFilter.java:
##########
@@ -145,14 +147,21 @@ private boolean isDispatchAllowed(HttpServletRequest 
request) {
       if (whitelist != null) {
         String requestURI = request.getRequestURI();
 
-        String decodedURL = null;
+        String decodedURL = requestURI;
         try {
           decodedURL = URLDecoder.decode(requestURI, 
StandardCharsets.UTF_8.name());
         } catch (UnsupportedEncodingException e) {
           //
         }
+        String baseUrl;
+        try {
+          URL url = new URL(decodedURL);
+          baseUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), 
"").toString();
+        } catch (MalformedURLException e) {
+          throw new RuntimeException(e);

Review Comment:
   We should log the error before wrapping the exception and throwing.



-- 
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: dev-unsubscr...@knox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to