From 5257c5024313cb34166330735a7966f3ea389d95 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Fri, 2 Jan 2026 05:38:30 +0300 Subject: [PATCH] fix(post_parser): correct content order when caption display flag is toggled The changes ensure that when `show_caption_above` is true, text content is rendered before media, and when false, media is rendered before text. This aligns the actual rendering order with the semantic meaning of the flag, fixing a bug where content ordering did not match user expectations. --- post_parser.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/post_parser.py b/post_parser.py index 07d6a21..093b6c7 100644 --- a/post_parser.py +++ b/post_parser.py @@ -615,19 +615,20 @@ class PostParser: show_caption_above = getattr(message, 'show_caption_above_media', False) if show_caption_above: - if media_html: - content_body.append(media_html) - content_body.append("
") if text_html: content_body.append(text_html) content_body.append("
") + if media_html: + content_body.append(media_html) + content_body.append("
") else: - if text_html: - content_body.append(text_html) - content_body.append("
") if media_html: content_body.append(media_html) content_body.append("
") + if text_html: + content_body.append(text_html) + content_body.append("
") + if poll_html: content_body.append(poll_html) # Poll if message.forward_origin: content_body.append(f"--- Forwarded post end ---") # Forward info end