From aafe229510bd670375c57a6360b804e8fa9ba12e Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Wed, 17 Apr 2024 22:39:56 +0800 Subject: [PATCH] server/auth: simplify code for isValidPermissionRange Not a big deal, but to make this function clearer. Signed-off-by: Jes Cok --- server/auth/range_perm_cache.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/server/auth/range_perm_cache.go b/server/auth/range_perm_cache.go index e791a241e2b..a540e121d0d 100644 --- a/server/auth/range_perm_cache.go +++ b/server/auth/range_perm_cache.go @@ -189,7 +189,7 @@ func isValidPermissionRange(key, rangeEnd []byte) bool { if len(key) == 0 { return false } - if rangeEnd == nil || len(rangeEnd) == 0 { // ensure rule b1 + if len(rangeEnd) == 0 { // ensure rule b1 return true } @@ -199,9 +199,5 @@ func isValidPermissionRange(key, rangeEnd []byte) bool { return true } - if isOpenEnded(rangeEnd) { - return true - } - - return false + return isOpenEnded(rangeEnd) }