From bba4c9b005982cd29dd07ae18eb43fa4048beb23 Mon Sep 17 00:00:00 2001 From: Jan Cernik <66427541+jancernik@users.noreply.github.com> Date: Fri, 3 Jan 2025 08:55:40 -0300 Subject: [PATCH] FIX: Fallback when embedding YouTube videos with lazy videos (#30514) --- plugins/discourse-lazy-videos/lib/lazy-videos/lazy_youtube.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/discourse-lazy-videos/lib/lazy-videos/lazy_youtube.rb b/plugins/discourse-lazy-videos/lib/lazy-videos/lazy_youtube.rb index 744e8b93905..4dc404a6437 100644 --- a/plugins/discourse-lazy-videos/lib/lazy-videos/lazy_youtube.rb +++ b/plugins/discourse-lazy-videos/lib/lazy-videos/lazy_youtube.rb @@ -20,6 +20,8 @@ class Onebox::Engine::YoutubeOnebox thumbnail_url = result[:image] end + return default_onebox_to_html if video_title.chomp("- YouTube").blank? || thumbnail_url.blank? + escaped_title = ERB::Util.html_escape(video_title) escaped_start_time = ERB::Util.html_escape(params["t"]) t_param = "&t=#{escaped_start_time}" if escaped_start_time.present?