From 88a51c3cf41005a65a92d4853112975af2d15fc8 Mon Sep 17 00:00:00 2001 From: Josh Ferge Date: Sun, 9 Nov 2025 23:38:14 -0500 Subject: [PATCH] fix(types): Extract debug_file_id for type narrowing Extract debug_file_id to a variable before the conditional check to enable proper type narrowing for mypy. --- src/sentry/api/endpoints/debug_files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sentry/api/endpoints/debug_files.py b/src/sentry/api/endpoints/debug_files.py index 1ec3c4ca598cb1..13b9268729d2b9 100644 --- a/src/sentry/api/endpoints/debug_files.py +++ b/src/sentry/api/endpoints/debug_files.py @@ -346,10 +346,11 @@ def delete(self, request: Request, project: Project) -> Response: :qparam string id: The id of the DIF to delete. :auth: required """ - if request.GET.get("id") and _has_delete_permission(request.access, project): + debug_file_id = request.GET.get("id") + if debug_file_id and _has_delete_permission(request.access, project): with atomic_transaction(using=router.db_for_write(File)): debug_file = ( - ProjectDebugFile.objects.filter(id=request.GET.get("id"), project_id=project.id) + ProjectDebugFile.objects.filter(id=debug_file_id, project_id=project.id) .select_related("file") .first() )