mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Fix response for proxied assets
This commit is contained in:
parent
b52e6c99ab
commit
ab4df7e078
2 changed files with 18 additions and 77 deletions
|
@ -629,3 +629,17 @@ def cache_annotation(db, id, annotations)
|
|||
db.exec("INSERT INTO annotations VALUES ($1, $2) ON CONFLICT DO NOTHING", id, annotations)
|
||||
end
|
||||
end
|
||||
|
||||
def proxy_file(response, env)
|
||||
if response.headers.includes_word?("Content-Encoding", "gzip")
|
||||
Gzip::Writer.open(env.response) do |deflate|
|
||||
IO.copy(response.body_io, deflate)
|
||||
end
|
||||
elsif response.headers.includes_word?("Content-Encoding", "deflate")
|
||||
Flate::Writer.open(env.response) do |deflate|
|
||||
IO.copy(response.body_io, deflate)
|
||||
end
|
||||
else
|
||||
IO.copy(response.body_io, env.response)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue