mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Fix body when proxying assets with status code > 300
This commit is contained in:
parent
b22393092b
commit
351ecfae0f
1 changed files with 10 additions and 9 deletions
|
@ -4695,18 +4695,19 @@ get "/ggpht/*" do |env|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
client.get(url, headers) do |response|
|
client.get(url, headers) do |response|
|
||||||
|
env.response.status_code = response.status_code
|
||||||
response.headers.each do |key, value|
|
response.headers.each do |key, value|
|
||||||
if !RESPONSE_HEADERS_BLACKLIST.includes? key
|
if !RESPONSE_HEADERS_BLACKLIST.includes? key
|
||||||
env.response.headers[key] = value
|
env.response.headers[key] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if response.status_code == 304
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
|
||||||
|
if response.status_code >= 300
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
|
||||||
|
|
||||||
proxy_file(response, env)
|
proxy_file(response, env)
|
||||||
end
|
end
|
||||||
rescue ex
|
rescue ex
|
||||||
|
@ -4750,12 +4751,12 @@ get "/sb/:id/:storyboard/:index" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if response.status_code >= 400
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
|
||||||
|
if response.status_code >= 300
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
|
||||||
|
|
||||||
proxy_file(response, env)
|
proxy_file(response, env)
|
||||||
end
|
end
|
||||||
rescue ex
|
rescue ex
|
||||||
|
@ -4795,12 +4796,12 @@ get "/vi/:id/:name" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if response.status_code == 304
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
|
||||||
|
if response.status_code >= 300
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
|
||||||
|
|
||||||
proxy_file(response, env)
|
proxy_file(response, env)
|
||||||
end
|
end
|
||||||
rescue ex
|
rescue ex
|
||||||
|
|
Loading…
Reference in a new issue