VideoProxy: Handle 302 redirects in chunked section

This commit is contained in:
Samantaz Fox 2024-11-10 17:30:42 +01:00
parent e7a93fcc18
commit 3ac8978e96
No known key found for this signature in database
GPG Key ID: F42821059186176E
1 changed files with 6 additions and 3 deletions

View File

@ -164,10 +164,13 @@ module Invidious::Routes::VideoPlayback
env.response.headers["Access-Control-Allow-Origin"] = "*" env.response.headers["Access-Control-Allow-Origin"] = "*"
if location = resp.headers["Location"]? if location = resp.headers["Location"]?
location = URI.parse(location) url = Invidious::HttpServer::Utils.proxy_video_url(location, region: region)
location = "#{location.request_target}&host=#{location.host}#{region ? "&region=#{region}" : ""}"
env.redirect location if title = query_params["title"]?
url = "#{url}&title=#{URI.encode_www_form(title)}"
end
env.redirect url
break break
end end