diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-09-17 14:48:02 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-09-17 14:48:02 -0500 |
| commit | 83ba4e2a4c1cb974d20499867b0fd445071ea07e (patch) | |
| tree | 8bf2dd13853e0371c0dbd66934f241c960bf491e /src/invidious.cr | |
| parent | 6cb834a18d770f859719102af78a018cc53e03f1 (diff) | |
| download | invidious-83ba4e2a4c1cb974d20499867b0fd445071ea07e.tar.gz invidious-83ba4e2a4c1cb974d20499867b0fd445071ea07e.tar.bz2 invidious-83ba4e2a4c1cb974d20499867b0fd445071ea07e.zip | |
Fix truncated thumbnails
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 5c809eab..38c3e018 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -3011,7 +3011,6 @@ get "/vi/:id/:name" do |env| client.get(url, headers) do |response| env.response.status_code = response.status_code - puts response.headers.inspect response.headers.each do |key, value| env.response.headers[key] = value end @@ -3021,23 +3020,23 @@ get "/vi/:id/:name" do |env| end chunk_size = 4096 - size = chunk_size + size = 1 if response.headers.includes_word?("Content-Encoding", "gzip") Gzip::Writer.open(env.response) do |deflate| - until size < chunk_size + until size == 0 size = IO.copy(response.body_io, deflate) env.response.flush end end elsif response.headers.includes_word?("Content-Encoding", "deflate") Flate::Writer.open(env.response) do |deflate| - until size < chunk_size + until size == 0 size = IO.copy(response.body_io, deflate) env.response.flush end end else - until size < chunk_size + until size == 0 size = IO.copy(response.body_io, env.response, chunk_size) env.response.flush end |
