summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-05-19 07:13:13 -0500
committerOmar Roth <omarroth@protonmail.com>2019-05-19 07:13:13 -0500
commit3ac8de0a647ed06396494b24c58ef1c60b11bd00 (patch)
treec89b1b921b0b9e1fd16887d74ccf75b87ed9c133 /src
parentf237fd984762204058ccfa248ea5c85c86413c2e (diff)
downloadinvidious-3ac8de0a647ed06396494b24c58ef1c60b11bd00.tar.gz
invidious-3ac8de0a647ed06396494b24c58ef1c60b11bd00.tar.bz2
invidious-3ac8de0a647ed06396494b24c58ef1c60b11bd00.zip
Fix proxy_file when response body is empty
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/helpers.cr4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr
index 9dac5213..a3af679e 100644
--- a/src/invidious/helpers/helpers.cr
+++ b/src/invidious/helpers/helpers.cr
@@ -631,6 +631,10 @@ def cache_annotation(db, id, annotations)
end
def proxy_file(response, env)
+ if response.headers["Content-Length"]? && response.headers["Content-Length"] == "0"
+ return
+ end
+
if response.headers.includes_word?("Content-Encoding", "gzip")
Gzip::Writer.open(env.response) do |deflate|
IO.copy(response.body_io, deflate)