From fe7e240321c826032b69d451e4fd9d3a01ca8533 Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 28 Jul 2017 10:35:24 -0600 Subject: [PATCH] Fix browser's range requests giving an empty file every second download attempt --- api/src/WebDAV/Server.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/WebDAV/Server.php b/api/src/WebDAV/Server.php index 3c5d802f41..bacf874cc5 100644 --- a/api/src/WebDAV/Server.php +++ b/api/src/WebDAV/Server.php @@ -1310,13 +1310,13 @@ class HTTP_WebDAV_Server if (isset($range['start'])) { fseek($options['stream'], $range['start'], SEEK_SET); if (feof($options['stream'])) { - $this->http_status("416 Requested range not satisfiable"); + $this->http_status($status = "416 Requested range not satisfiable"); return; } if (!empty($range['end'])) { $size = $range['end']-$range['start']+1; - $this->http_status("206 Partial content"); + $this->http_status($status = "206 Partial content"); if (!self::use_compression()) header("Content-Length: $size"); header("Content-Range: bytes $range[start]-$range[end]/" . (isset($options['size']) ? $options['size'] : "*")); @@ -1326,7 +1326,7 @@ class HTTP_WebDAV_Server echo $buffer; } } else { - $this->http_status("206 Partial content"); + $this->http_status($status = "206 Partial content"); if (isset($options['size'])) { if (!self::use_compression()) header("Content-Length: ".($options['size'] - $range['start'])); header("Content-Range: bytes ".$range['start']."-".