♻️(backend) improve scope prefix removal logic
The previous replace usage was too broad and could remove multiple occurrences, which was not the original intention. Replace the replace call with removeprefix, which more accurately matches the expected behavior by only removing the prefix when present at the start of the string.
This commit is contained in:
committed by
aleb_the_flash
parent
f8c6da8021
commit
ed5c1bbd84
@@ -59,7 +59,7 @@ class BaseScopePermission(permissions.BasePermission):
|
||||
|
||||
if settings.OIDC_RS_SCOPES_PREFIX:
|
||||
token_scopes = [
|
||||
scope.replace(f"{settings.OIDC_RS_SCOPES_PREFIX}:", "")
|
||||
scope.removeprefix(f"{settings.OIDC_RS_SCOPES_PREFIX}:")
|
||||
for scope in token_scopes
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user