From 6c11f943d0df6e399d42631004678daa08248a7e Mon Sep 17 00:00:00 2001 From: Cris Ward Date: Thu, 28 Sep 2017 12:07:26 +0100 Subject: [PATCH] Better fix for safari video bug This seems to work everywhere that I've tested. --- src/kemal/helpers/helpers.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kemal/helpers/helpers.cr b/src/kemal/helpers/helpers.cr index 87c8947..94b643c 100644 --- a/src/kemal/helpers/helpers.cr +++ b/src/kemal/helpers/helpers.cr @@ -149,14 +149,14 @@ private def multipart(file, env : HTTP::Server::Context) end if endb == 0 - endb = fileb + endb = fileb - 1 end if startb < endb && endb <= fileb env.response.status_code = 206 env.response.content_length = endb - startb env.response.headers["Accept-Ranges"] = "bytes" - env.response.headers["Content-Range"] = "bytes #{startb}-#{endb > 1 ? endb - 1 : 1}/#{fileb}" # MUST + env.response.headers["Content-Range"] = "bytes #{startb}-#{endb}/#{fileb}" # MUST if startb > 1024 skipped = 0