From 2f4ee75e1c32b6b738d6309420184344eda58885 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Mon, 26 Apr 2021 10:25:21 +0200
Subject: [PATCH] Harder block for annoying search queries

---
 scipost/forms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scipost/forms.py b/scipost/forms.py
index d163df194..7c5cf4bf6 100644
--- a/scipost/forms.py
+++ b/scipost/forms.py
@@ -704,7 +704,7 @@ class SearchForm(HayStackSearchForm):
             return self.no_query_found()
 
         # Block queries matching flagged regex to avoid gunicorn worker timeout
-        if re.search(r'\w+.www.\w+.cn', self.cleaned_data["q"]):
+        if re.search(r'\w+.cn', self.cleaned_data["q"]):
             raise Http404
 
         sqs = self.searchqueryset.auto_query(self.cleaned_data["q"])
-- 
GitLab