Skip to content

Commit 91c0ae4

Browse files
committed
VideoProxy: Handle 302 redirects in chunked section
1 parent e7a93fc commit 91c0ae4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/invidious/routes/video_playback.cr

+6-4
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,13 @@ module Invidious::Routes::VideoPlayback
164164
env.response.headers["Access-Control-Allow-Origin"] = "*"
165165

166166
if location = resp.headers["Location"]?
167-
location = URI.parse(location)
168-
location = "#{location.request_target}&host=#{location.host}#{region ? "&region=#{region}" : ""}"
167+
url = Invidious::HttpServer::Utils.proxy_video_url(location, region: region)
169168

170-
env.redirect location
171-
break
169+
if title = query_params["title"]?
170+
url = "#{url}&title=#{URI.encode_www_form(title)}"
171+
end
172+
173+
return env.redirect url
172174
end
173175

174176
if title = query_params["title"]?

0 commit comments

Comments
 (0)