Fix whitespace stripping in video warning template

Applied the same inline computation fix to {video_warning} placeholder
that was previously done for {common_date} and {common_location}.

Computes video_warning_text inline using {%- set -%} syntax instead of
storing as a separate HA variable, which strips leading whitespace.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 21:28:12 +03:00
parent 330026a44a
commit d8df567d02
2 changed files with 7 additions and 8 deletions

View File

@@ -981,10 +981,6 @@ variables:
has_videos_in_assets: >
{{ filtered_assets | selectattr('type', 'equalto', 'VIDEO') | list | length > 0 }}
# Video warning text (only populated when Telegram media is enabled and videos are present)
video_warning_text: >-
{% if send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0 %}{{ telegram_video_warning_template }}{% else %}{{ '' }}{% endif %}
# Filter assets that have valid URLs (for Telegram media)
# URL preference: playback_url (videos), photo_url (images) > download_url > url (viewer)
assets_with_urls: >
@@ -1721,12 +1717,13 @@ action:
{%- set tpl = message_assets_added_template -%}
{%- set msg_common_date = (common_date_template | replace('{date}', unique_dates[0])) if unique_dates | length == 1 else '' -%}
{%- set msg_common_location = (common_location_template | replace('{location}', unique_locations[0])) if all_assets_have_location and unique_locations | length == 1 else '' -%}
{%- set msg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
{{ tpl | replace('{album_name}', event_album_name)
| replace('{album_url}', event_album_url)
| replace('{added_count}', filtered_added_count | string)
| replace('{people}', people_list)
| replace('{assets}', assets_list)
| replace('{video_warning}', video_warning_text)
| replace('{video_warning}', msg_video_warning)
| replace('{common_date}', msg_common_date)
| replace('{common_location}', msg_common_location) }}
@@ -1774,12 +1771,13 @@ action:
{%- set tpl = message_assets_added_template -%}
{%- set chg_common_date = (common_date_template | replace('{date}', unique_dates[0])) if unique_dates | length == 1 else '' -%}
{%- set chg_common_location = (common_location_template | replace('{location}', unique_locations[0])) if all_assets_have_location and unique_locations | length == 1 else '' -%}
{%- set chg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
{{ tpl | replace('{album_name}', event_album_name)
| replace('{album_url}', event_album_url)
| replace('{added_count}', filtered_added_count | string)
| replace('{people}', people_list)
| replace('{assets}', assets_list)
| replace('{video_warning}', video_warning_text)
| replace('{video_warning}', chg_video_warning)
| replace('{common_date}', chg_common_date)
| replace('{common_location}', chg_common_location) }}
@@ -1953,12 +1951,13 @@ action:
{%- set tpl = message_assets_added_template -%}
{%- set tg_common_date = (common_date_template | replace('{date}', unique_dates[0])) if unique_dates | length == 1 else '' -%}
{%- set tg_common_location = (common_location_template | replace('{location}', unique_locations[0])) if all_assets_have_location and unique_locations | length == 1 else '' -%}
{%- set tg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
{{ tpl | replace('{album_name}', event_album_name)
| replace('{album_url}', event_album_url)
| replace('{added_count}', filtered_added_count | string)
| replace('{people}', people_list)
| replace('{assets}', assets_list)
| replace('{video_warning}', video_warning_text)
| replace('{video_warning}', tg_video_warning)
| replace('{common_date}', tg_common_date)
| replace('{common_location}', tg_common_location) }}

View File

@@ -1,3 +1,3 @@
{
"version": "1.22.7"
"version": "1.22.8"
}