diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2022-09-03 19:26:05 +0200 |
|---|---|---|
| committer | Samantaz Fox <coding@samantaz.fr> | 2022-09-03 19:26:05 +0200 |
| commit | 8ab339396a48c6ce661e71e9a988a600ff06d7d1 (patch) | |
| tree | efc366f27afc6198155ed73c19a7e45f332e8845 /src | |
| parent | 5048a89b9b66cd8ba719cc4426b6ee4ec33ab3b5 (diff) | |
| parent | 260bab598e00fe769ff36ba2c171768a1fbc31bb (diff) | |
| download | invidious-8ab339396a48c6ce661e71e9a988a600ff06d7d1.tar.gz invidious-8ab339396a48c6ce661e71e9a988a600ff06d7d1.tar.bz2 invidious-8ab339396a48c6ce661e71e9a988a600ff06d7d1.zip | |
Message when the video doesn't exist in playlist (#3243)
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/routes/embed.cr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/invidious/routes/embed.cr b/src/invidious/routes/embed.cr index 84da9993..e6486587 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, "error_video_not_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, "error_video_not_in_playlist", url)) + end rescue ex : NotFoundException return error_template(404, ex) rescue ex |
