未验证 提交 bbfb5462 编写于 作者: H huanggze

log: fix crash if api caller has no access to provided namespaces

Signed-off-by: Nhuanggze <loganhuang@yunify.com>
上级 86ae12d1
......@@ -339,6 +339,7 @@ func ListDevopsRules(req *restful.Request, resp *restful.Response) {
}
func LogQuery(req *restful.Request, resp *restful.Response) {
operation := req.QueryParameter("operation")
req, err := regenerateLoggingRequest(req)
switch {
case err != nil:
......@@ -346,10 +347,11 @@ func LogQuery(req *restful.Request, resp *restful.Response) {
case req != nil:
logging.LoggingQueryCluster(req, resp)
default:
if req.QueryParameter("operation") == "export" {
if operation == "export" {
resp.Header().Set("Content-Type", restful.MIME_OCTET)
resp.Write(nil)
} else {
resp.WriteAsJson(loggingv1alpha2.QueryResult{})
resp.WriteAsJson(loggingv1alpha2.QueryResult{Read: new(loggingv1alpha2.ReadResult)})
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册