diff --git a/Whatsapp_Chat_Exporter/utility.py b/Whatsapp_Chat_Exporter/utility.py index 6ccbee6..c974dbf 100644 --- a/Whatsapp_Chat_Exporter/utility.py +++ b/Whatsapp_Chat_Exporter/utility.py @@ -213,6 +213,9 @@ def rendering( if "??" not in headline: raise ValueError("Headline must contain '??' to replace with name") headline = headline.replace("??", name) + # Create a temporary lookup map only at render-time; + # media preview in reply is a UI-specific concern and + # is ignored by the core database processing with open(output_file_name, "w", encoding="utf-8") as f: f.write( template.render( @@ -226,7 +229,8 @@ def rendering( previous=previous, status=chat.status, media_base=chat.media_base, - headline=headline + headline=headline, + msg_map={m.key_id: m for m in msgs}.get ) ) diff --git a/Whatsapp_Chat_Exporter/whatsapp.html b/Whatsapp_Chat_Exporter/whatsapp.html index 3d1115a..e8a40f6 100644 --- a/Whatsapp_Chat_Exporter/whatsapp.html +++ b/Whatsapp_Chat_Exporter/whatsapp.html @@ -355,7 +355,7 @@ {% endif %}

- {% set replied_msg = msgs | selectattr('key_id', 'equalto', msg.reply) | first %} + {% set replied_msg = msg_map(msg.reply) %} {% if replied_msg and replied_msg.media == true %}
{% if "image/" in replied_msg.mime %} @@ -461,7 +461,7 @@ {% endif %}

- {% set replied_msg = msgs | selectattr('key_id', 'equalto', msg.reply) | first %} + {% set replied_msg = msg_map(msg.reply) %} {% if replied_msg and replied_msg.media == true %}
{% if "image/" in replied_msg.mime %}