replace strings.Index with strings.Contains instead

replace strings.Index() !=-1  with strings.Contains instead

Kubernetes-commit: 037847066ce7ebb622c4b207355ac97814414841
This commit is contained in:
VillageHeadHuang 2023-07-14 15:25:36 +08:00 committed by Kubernetes Publisher
parent 8e2b0eca2e
commit e6c3a57fb9
1 changed files with 1 additions and 1 deletions

View File

@ -714,7 +714,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
requestScope = "resource"
operationSuffix = operationSuffix + "WithPath"
}
if strings.Index(action.Path, "/{name}") != -1 || action.Verb == "POST" {
if strings.Contains(action.Path, "/{name}") || action.Verb == "POST" {
requestScope = "resource"
}
if action.AllNamespaces {