From d9658a7f914e21f4a2beff8d798664f3621c4a69 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 10 Sep 2021 17:53:49 +0200 Subject: [PATCH] [fix] searx/results.py: strip result['content'] only if it exists fix PR #302 --- searx/results.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/searx/results.py b/searx/results.py index ae8cf2498..2e81f5dc4 100644 --- a/searx/results.py +++ b/searx/results.py @@ -255,7 +255,8 @@ class ResultContainer: result['url'] = result['parsed_url'].geturl() # strip multiple spaces and cariage returns from content - result['content'] = WHITESPACE_REGEX.sub(' ', result['content']) + if result.get('content'): + result['content'] = WHITESPACE_REGEX.sub(' ', result['content']) return True