You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/02/26 04:33:03 UTC

[GitHub] [helix] pkuwm opened a new pull request #811: Fix zookeeper endpoint error when path has leading slash

pkuwm opened a new pull request #811: Fix zookeeper endpoint error when path has leading slash
URL: https://github.com/apache/helix/pull/811
 
 
   ### Issues
   
   - [ ] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #810
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI changes:
   
   If path has leading slash in Zookeeper REST endpoint: `/zookeeper//tmp/folder`, response is incorrect: response status code is 400.
   
   This endpoint should be able to handle the case correctly.
   
   ### Tests
   
   - [ ] The following tests are written for this issue:
   
    - testPathHasLeadingSlash
   
   - [ ] The following is the result of the "mvn test" command on the appropriate module:
   
   (Copy & paste the result of "mvn test")
   
   ### Commits
   
   - [ ] My commits all reference appropriate Apache Helix GitHub issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [ ] In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Code Quality
   
   - [ ] My diff has been formatted using helix-style.xml

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] dasahcc commented on a change in pull request #811: Fix zookeeper endpoint error when path has leading slash

Posted by GitBox <gi...@apache.org>.
dasahcc commented on a change in pull request #811: Fix zookeeper endpoint error when path has leading slash
URL: https://github.com/apache/helix/pull/811#discussion_r384659620
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/zookeeper/ZooKeeperAccessor.java
 ##########
 @@ -62,14 +62,20 @@ public Response get(@PathParam("path") String path, @QueryParam("command") Strin
     if (cmd == null) {
       return badRequest("Invalid ZooKeeper command: " + commandStr);
     }
+    if (path == null) {
+      return badRequest("Path is missing in the request!");
+    }
 
     // Lazily initialize ZkBaseDataAccessor
     ServerContext _serverContext =
         (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name());
     _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor();
 
-    // Need to prepend a "/" since JAX-RS regex removes it
-    path = "/" + path;
+    if (path.isEmpty() || path.charAt(0) != '/') {
 
 Review comment:
   This path is getting from URL. Why we have different behavior? Sometimes it has slash sometimes not?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] narendly commented on a change in pull request #811: Fix zookeeper endpoint error when path has leading slash

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #811: Fix zookeeper endpoint error when path has leading slash
URL: https://github.com/apache/helix/pull/811#discussion_r384666372
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/zookeeper/ZooKeeperAccessor.java
 ##########
 @@ -62,14 +62,20 @@ public Response get(@PathParam("path") String path, @QueryParam("command") Strin
     if (cmd == null) {
       return badRequest("Invalid ZooKeeper command: " + commandStr);
     }
+    if (path == null) {
 
 Review comment:
   I don't think this PR is necessary because it is the caller's responsibility to correctly format the URL. With the correct URL, it has already been verified and tested that these endpoints work as expected.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org