chia7712 commented on code in PR #905:
URL: https://github.com/apache/yunikorn-core/pull/905#discussion_r1663068429
##########
pkg/webservice/handlers.go:
##########
@@ -668,12 +669,17 @@ func getPartitionQueue(w http.ResponseWriter, r
*http.Request) {
return
}
queueName := vars.ByName("queue")
- queueErr := validateQueue(queueName)
+ escapedQueueName, err := url.QueryUnescape(queueName)
+ if err != nil {
+ buildJSONErrorResponse(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+ queueErr := validateQueue(escapedQueueName)
Review Comment:
Maybe we can introduce a small helper for all params?
```go
func byName(vars httprouter.Params, name string) (string, error) {
value := vars.ByName(name)
unescape, err := url.QueryUnescape(value)
if err != nil {
return "", err
}
return unescape, nil
}
queueName, err := byName(vars, "queue")
if err != nil {
buildJSONErrorResponse(w, err.Error(), http.StatusBadRequest)
return
}
```
https://issues.apache.org/jira/browse/YUNIKORN-2712 can leverage this helper
to add `missing` check
--
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]