FIX: Video thumbnails for missing videos (#28152)

Skip trying to find a thumbnail if the video src cannot be found.

Bug report: https://meta.discourse.org/t/317423
This commit is contained in:
Blake Erickson
2024-07-31 10:54:52 -06:00
committed by GitHub
parent fa6dbbed1b
commit 30048ab97f
2 changed files with 39 additions and 0 deletions

View File

@ -452,6 +452,7 @@ module PrettyText
.css(".video-placeholder-container")
.each do |video|
video_src = video["data-video-src"]
next if video_src == "/404" || video_src.nil?
video_sha1 = File.basename(video_src, File.extname(video_src))
thumbnail = Upload.where("original_filename LIKE ?", "#{video_sha1}.%").last
if thumbnail