From 5c3ba375ba3b388673c0a8bda3ff9b740771f0df Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 25 Mar 2023 21:04:20 +0200 Subject: [PATCH] move if condition --- files/helpers/sanitize.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index f05fb0c3b..29ff93d22 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -637,10 +637,9 @@ def complies_with_chud(obj): soup = BeautifulSoup(obj.body_html, 'lxml') #torture body_html - tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'}, recursive=False) + tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False) for tag in tags: - if not tag.string: continue - tag.string.replace_with(torture_ap(tag.text, obj.author.username)) + tag.string.replace_with(torture_ap(tag.string, obj.author.username)) obj.body_html = str(soup) #torture title_html and check for agendaposter_phrase in plain title and leave if it's there