From 8e1c7c2f80cc88609274272dc15faabd8d4b7eca Mon Sep 17 00:00:00 2001 From: bashrc Date: Tue, 18 Aug 2026 10:21:11 +0100 Subject: [PATCH] Check if image alt text is the same as content --- src/announce.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/announce.py b/src/announce.py index 3201a04d4..f03004502 100644 --- a/src/announce.py +++ b/src/announce.py @@ -13,6 +13,7 @@ from pprint import pprint from src.flags import has_group_type from src.flags import url_permitted from src.status import get_status_number +from src.utils import remove_html from src.utils import remove_post_from_cache from src.utils import get_cached_post_filename from src.utils import load_json @@ -772,6 +773,7 @@ def disallow_announce(content: str, attachment: [], capabilities: {}) -> bool: return True # check for attached images without descriptions + # or where the description is the same as the content if isinstance(attachment, list): for item in attachment: if not isinstance(item, dict): @@ -791,4 +793,10 @@ def disallow_announce(content: str, attachment: [], capabilities: {}) -> bool: if len(image_description) < 5: # not enough description return True + # compare content with description, removing any formatting + content2 = content.strip().lower() + description2 = image_description.strip().lower() + if remove_html(content2) == remove_html(description2): + # content is the same as description + return True return False