Skip to content

Commit 896b77e

Browse files
authored
Merge pull request kubernetes#85800 from beautytiger/dev-191202-fixtrim
fix: replace TrimLeft with TrimPrefix and TrimRight with TrimSuffix
2 parents bb9981e + 51b7ef2 commit 896b77e

File tree

1 file changed

+2
-2
lines changed
  • staging/src/k8s.io/apiserver/pkg/audit/policy

1 file changed

+2
-2
lines changed

staging/src/k8s.io/apiserver/pkg/audit/policy/checker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ func ruleMatchesResource(r *audit.PolicyRule, attrs authorizer.Attributes) bool
185185
return true
186186
}
187187
// match "*/subresource"
188-
if len(subresource) > 0 && strings.HasPrefix(res, "*/") && subresource == strings.TrimLeft(res, "*/") {
188+
if len(subresource) > 0 && strings.HasPrefix(res, "*/") && subresource == strings.TrimPrefix(res, "*/") {
189189
return true
190190
}
191191
// match "resource/*"
192-
if strings.HasSuffix(res, "/*") && resource == strings.TrimRight(res, "/*") {
192+
if strings.HasSuffix(res, "/*") && resource == strings.TrimSuffix(res, "/*") {
193193
return true
194194
}
195195
}

0 commit comments

Comments
 (0)