From 6afc93324b85f7042017be932e0688ae7e86f094 Mon Sep 17 00:00:00 2001 From: Tejas Saubhage Date: Sat, 14 Mar 2026 11:17:19 -0400 Subject: [PATCH] Fix SonarQube API: raise clear error when project_name is None fixes #13959 --- dojo/tools/api_sonarqube/api_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dojo/tools/api_sonarqube/api_client.py b/dojo/tools/api_sonarqube/api_client.py index 91a7673c812..ee248a1983b 100644 --- a/dojo/tools/api_sonarqube/api_client.py +++ b/dojo/tools/api_sonarqube/api_client.py @@ -1,5 +1,6 @@ import requests from django.conf import settings +from django.core.exceptions import ValidationError from requests.exceptions import JSONDecodeError as RequestsJSONDecodeError from dojo.utils import prepare_for_view @@ -62,6 +63,9 @@ def find_project(self, project_name, organization=None, branch=None): :param project_name: :return: """ + if not project_name: + msg = "Project name is required. Please provide a Service Key 1 or ensure the Product name is set." + raise ValidationError(msg) parameters = {"q": project_name, "qualifiers": "TRK"} if branch: