diff --git a/discordbot/youtube.py b/discordbot/youtube.py index 8b85b7d..aced012 100644 --- a/discordbot/youtube.py +++ b/discordbot/youtube.py @@ -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: diff --git a/webapp/youtube.py b/webapp/youtube.py index 8d156d4..2d5f8cb 100644 --- a/webapp/youtube.py +++ b/webapp/youtube.py @@ -112,7 +112,7 @@ def addYouTube(): embed_color=embed_color, embed_footer=request.form.get('embed_footer') or None, embed_author_name=request.form.get('embed_author_name') or None, - embed_author_icon=request.form.get('embed_author_icon') or None, + embed_author_icon=(request.form.get('embed_author_icon') or '').strip() or None, embed_thumbnail=request.form.get('embed_thumbnail') == 'on', embed_image=request.form.get('embed_image') == 'on' ) @@ -177,7 +177,7 @@ def submitEditYouTube(id): notification.embed_color = embed_color notification.embed_footer = request.form.get('embed_footer') or None notification.embed_author_name = request.form.get('embed_author_name') or None - notification.embed_author_icon = request.form.get('embed_author_icon') or None + notification.embed_author_icon = (request.form.get('embed_author_icon') or '').strip() or None notification.embed_thumbnail = request.form.get('embed_thumbnail') == 'on' notification.embed_image = request.form.get('embed_image') == 'on' db.session.commit()