From ed5c1bbd844f9c24ad9e76f4e47175e0b2c11b72 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Sun, 8 Feb 2026 18:19:49 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(backend)=20improve=20scope?= =?UTF-8?q?=20prefix=20removal=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/backend/core/external_api/permissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/core/external_api/permissions.py b/src/backend/core/external_api/permissions.py index 0b1873fd..82315b6e 100644 --- a/src/backend/core/external_api/permissions.py +++ b/src/backend/core/external_api/permissions.py @@ -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 ]