Refactor author icon handling in YouTube notifications. Updated the logic to strip whitespace from the author icon URL and ensure it starts with a valid HTTP/HTTPS scheme. This change improves the robustness of the embed author icon feature in both the Discord bot and web application.

This commit is contained in:
2026-03-07 00:49:20 +01:00
parent b8ead19360
commit eedc7e4203
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -218,7 +218,8 @@ async def _sendMessage(notification: YouTubeNotification, message: str, video_ur
embed.description = embed_description
author_name = _format_embed_text(notification.embed_author_name, channel_name, video_title, video_url, video_id, thumbnail, published_at, is_short) if notification.embed_author_name else channel_name
author_icon = notification.embed_author_icon if notification.embed_author_icon else "https://www.youtube.com/img/desktop/yt_1200.png"
author_icon_raw = (notification.embed_author_icon or "").strip()
author_icon = author_icon_raw if author_icon_raw.startswith(("http://", "https://")) else "https://www.youtube.com/img/desktop/yt_1200.png"
embed.set_author(name=author_name, icon_url=author_icon)
if notification.embed_thumbnail and thumbnail: