Handle invalid attribution_links in brand_redirect

This commit is contained in:
syeopite 2021-08-03 00:59:04 -07:00
parent 6b5035bb83
commit c72febe7a6
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82

View File

@ -115,12 +115,11 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute
begin
resolved_url = YoutubeAPI.resolve_url("https://youtube.com#{env.request.path}#{yt_url_params.size > 0 ? "?#{yt_url_params}" : ""}")
rescue ex : InfoException
raise InfoException.new("This channel does not exist.")
ucid = resolved_url["endpoint"]["browseEndpoint"]["browseId"]
rescue ex : InfoException | KeyError
raise InfoException.new(translate(locale, "This channel does not exist."))
end
ucid = resolved_url["endpoint"]["browseEndpoint"]["browseId"]
selected_tab = env.request.path.split("/")[-1]
if ["home", "videos", "playlists", "community", "channels", "about"].includes? selected_tab
url = "/channel/#{ucid}/#{selected_tab}"