Skip to content

Commit ccc46b6

Browse files
committed
Handle non-integer values
1 parent cc9d829 commit ccc46b6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/sentry/workflow_engine/endpoints/organization_detector_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def filter_detectors(self, request: Request, organization: Any) -> QuerySet[Dete
227227
if isinstance(filter.value.value, list)
228228
else [filter.value.value]
229229
)
230-
workflow_ids = [int(v) for v in workflow_ids]
230+
workflow_ids = to_valid_int_id_list("workflow", workflow_ids)
231231
if filter.operator in ("!=", "NOT IN"):
232232
queryset = queryset.exclude(
233233
detectorworkflow__workflow_id__in=workflow_ids

tests/sentry/workflow_engine/endpoints/test_organization_detector_index.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,13 @@ def test_query_by_workflow(self) -> None:
560560
assert detector_a.name not in returned_names
561561
assert detector_b.name not in returned_names
562562

563+
def test_query_by_workflow_invalid_value(self) -> None:
564+
self.get_error_response(
565+
self.organization.slug,
566+
qs_params={"project": self.project.id, "query": "workflow:abc"},
567+
status_code=400,
568+
)
569+
563570
def test_query_by_assignee_user_email(self) -> None:
564571
user = self.create_user(email="assignee@example.com")
565572
self.create_member(organization=self.organization, user=user)

0 commit comments

Comments
 (0)