mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 16:19:53 +05:30
Fix 404 handling for endpoints matching short URLs
This commit is contained in:
parent
27e032d10d
commit
f065a21542
@ -2409,7 +2409,7 @@ get "/feed/subscriptions" do |env|
|
||||
env.set "user", user
|
||||
|
||||
templated "subscriptions"
|
||||
end
|
||||
end
|
||||
|
||||
get "/feed/history" do |env|
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
@ -2434,7 +2434,7 @@ get "/feed/history" do |env|
|
||||
end
|
||||
|
||||
templated "history"
|
||||
end
|
||||
end
|
||||
|
||||
get "/feed/channel/:ucid" do |env|
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
@ -2508,7 +2508,7 @@ get "/feed/channel/:ucid" do |env|
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get "/feed/private" do |env|
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
@ -5058,6 +5058,11 @@ error 404 do |env|
|
||||
response = client.get(response.headers["Location"])
|
||||
end
|
||||
|
||||
if response.body.empty?
|
||||
env.response.headers["Location"] = "/"
|
||||
halt env, status_code: 302
|
||||
end
|
||||
|
||||
html = XML.parse_html(response.body)
|
||||
ucid = html.xpath_node(%q(//meta[@itemprop="channelId"]))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user