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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]