summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmilien Devos <contact@emiliendevos.be>2022-08-06 13:14:35 +0200
committerÉmilien Devos <contact@emiliendevos.be>2022-08-23 11:45:44 +0000
commitca4c2115eebd5b3eaeb7ebf9e4e704ad83e5b4bf (patch)
tree75d3f0afb04103e99d0f7c9f6e0d27dab27c6285 /src
parent4ab54f284c8585f2edec44a4b0d369813389e142 (diff)
downloadinvidious-ca4c2115eebd5b3eaeb7ebf9e4e704ad83e5b4bf.tar.gz
invidious-ca4c2115eebd5b3eaeb7ebf9e4e704ad83e5b4bf.tar.bz2
invidious-ca4c2115eebd5b3eaeb7ebf9e4e704ad83e5b4bf.zip
Message when the video doesn't exist in playlist
Diffstat (limited to 'src')
-rw-r--r--src/invidious/routes/embed.cr10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/invidious/routes/embed.cr b/src/invidious/routes/embed.cr
index 84da9993..7860f8b9 100644
--- a/src/invidious/routes/embed.cr
+++ b/src/invidious/routes/embed.cr
@@ -2,11 +2,16 @@
module Invidious::Routes::Embed
def self.redirect(env)
+ locale = env.get("preferences").as(Preferences).locale
if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
begin
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(translate(locale, "video_not_exist_in_playlist", url))
+ end
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex
@@ -26,6 +31,7 @@ module Invidious::Routes::Embed
end
def self.show(env)
+ locale = env.get("preferences").as(Preferences).locale
id = env.params.url["id"]
plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
@@ -62,6 +68,10 @@ 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(translate(locale, "video_not_exist_in_playlist", url))
+ end
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex