Merge pull request #3547 from pingstar/dev

Fix: the panic caused by parsing requestinfo slice access out of bounds
This commit is contained in:
KubeSphere CI Bot
2021-04-06 16:29:13 +08:00
committed by GitHub

View File

@@ -182,7 +182,7 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er
requestInfo.APIVersion = currentParts[0]
currentParts = currentParts[1:]
if specialVerbs.Has(currentParts[0]) {
if len(currentParts) > 0 && specialVerbs.Has(currentParts[0]) {
if len(currentParts) < 2 {
return &requestInfo, fmt.Errorf("unable to determine kind and namespace from url: %v", req.URL)
}