From 8afcafbbdafa6a6b54bdccd7dae8f5d98329a749 Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Fri, 21 Jun 2024 14:39:25 -0400 Subject: [PATCH] ref: fix passing slug=None to HC slug check this produces an INFO log on every logged out request --- src/sentry/web/frontend/auth_login.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/sentry/web/frontend/auth_login.py b/src/sentry/web/frontend/auth_login.py index bca2e311c8e45..faf5dfc9fbd55 100644 --- a/src/sentry/web/frontend/auth_login.py +++ b/src/sentry/web/frontend/auth_login.py @@ -504,10 +504,11 @@ def org_exists(self, request: Request) -> bool: """ Returns True if the organization passed in a request exists. """ - return bool( + return request.subdomain is not None and ( organization_service.check_organization_by_slug( slug=request.subdomain, only_visible=True ) + is not None ) def can_register(self, request: Request) -> bool: @@ -563,13 +564,7 @@ def handle_basic_auth(self, request: Request, **kwargs) -> HttpResponseBase: op = request.POST.get("op") organization = kwargs.pop("organization", None) - org_exists = bool( - organization_service.check_organization_by_slug( - slug=request.subdomain, only_visible=True - ) - ) - - if request.method == "GET" and request.subdomain and org_exists: + if request.method == "GET" and request.subdomain and self.org_exists(request): urls = [ reverse("sentry-auth-organization", args=[request.subdomain]), reverse("sentry-register"),