Message when the video doesn't exist in playlist

This commit is contained in:
Emilien Devos 2022-08-06 13:14:35 +02:00
parent 4ab54f284c
commit 9fd30ab1cc
1 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,11 @@ module Invidious::Routes::Embed
playlist = get_playlist(plid)
offset = env.params.query["index"]?.try &.to_i? || 0
videos = get_playlist_videos(playlist, offset: offset)
if videos.empty?
url = "/playlist?list=#{plid}"
raise NotFoundException.new("The video requested doesn't exist in the playlist. " \
"Click <a href='#{url}'>here</a> for the playlist home page.")
end
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex
@ -62,6 +67,11 @@ module Invidious::Routes::Embed
playlist = get_playlist(plid)
offset = env.params.query["index"]?.try &.to_i? || 0
videos = get_playlist_videos(playlist, offset: offset)
if videos.empty?
url = "/playlist?list=#{plid}"
raise NotFoundException.new("The video requested doesn't exist in the playlist. " \
"Click <a href='#{url}'>here</a> for the playlist home page.")
end
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex