From ee17bc07786142e4caf5379409b7200e4940d031 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 14 May 2024 13:55:18 -0500 Subject: [PATCH] Add validation for random problem --- judge/views/problem.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/judge/views/problem.py b/judge/views/problem.py index 741b8c9..d85f5ad 100644 --- a/judge/views/problem.py +++ b/judge/views/problem.py @@ -949,6 +949,12 @@ class LanguageTemplateAjax(View): class RandomProblem(ProblemList): def get(self, request, *args, **kwargs): self.setup_problem_list(request) + + try: + return super().get(request, *args, **kwargs) + except ProgrammingError as e: + return generic_message(request, "FTS syntax error", e.args[1], status=400) + if self.in_contest: raise Http404()