Browse Source

[fix] searx/results.py: strip result['content'] only if it exists

fix PR #302
Alexandre Flament 3 years ago
parent
commit
d9658a7f91
1 changed files with 2 additions and 1 deletions
  1. 2 1
      searx/results.py

+ 2 - 1
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