fix: Fix stream download

guzzlehttp/psr7 1.6 does not accept empty headers
This commit is contained in:
Pierre Rudloff 2019-07-04 23:12:44 +02:00
parent ee7c727f91
commit 5f5b0a5cf5

View file

@ -164,7 +164,13 @@ class DownloadController extends BaseController
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext);
$body = new Stream($this->video->getM3uStream());
} else {
$stream = $this->video->getHttpResponse(['Range' => $request->getHeader('Range')]);
$range = $request->getHeader('Range');
if (empty($range)) {
$headers = [];
} else {
$headers = ['Range' => $range];
}
$stream = $this->video->getHttpResponse($headers);
$response = $response->withHeader('Content-Type', $stream->getHeader('Content-Type'));
$response = $response->withHeader('Content-Length', $stream->getHeader('Content-Length'));