Commit 4eaa5ddb authored by sebt3's avatar sebt3
Browse files

Fixing download have no size

parent a264e47c
......@@ -723,7 +723,7 @@ group by b.mon order by b.mon asc');
'p' => $p,
'versions' => $this->getVersionDetails($id)
]);
return $resp->withHeader('Content-type', 'text/markdown');
return $resp->withHeader('Content-type', 'text/markdown')->withHeader('Content-Disposition', 'attachment; filename="README.md"');
}
/////////////////////////////////////////////////////////////////////////////////////////////
......@@ -989,6 +989,7 @@ group by b.mon order by b.mon asc');
return $response->withRedirect($this->router->pathFor('packages.list'));
}
$this->addDownload($p['last_vers']);
$size = filesize($p['path']);
$fh = fopen($p['path'], 'rb');
$stream = new \Slim\Http\Stream($fh); // create a stream instance for the response body
......@@ -997,6 +998,7 @@ group by b.mon order by b.mon asc');
->withHeader('Content-Type', 'application/octet-stream')
->withHeader('Content-Description', 'File Transfer')
->withHeader('Content-Transfer-Encoding', 'binary')
->withHeader('Content-Length', $size)
->withHeader('Content-Disposition', 'attachment; filename="' . $p['dbp_str_id'].'-'.$p['version'].'.dbp' . '"')
->withHeader('Expires', '0')
->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
......@@ -1013,6 +1015,7 @@ group by b.mon order by b.mon asc');
return $response->withRedirect($this->router->pathFor('packages.list'));
}
$this->addDownload($id);
$size = filesize($v['path']);
$fh = fopen($v['path'], 'rb');
$stream = new \Slim\Http\Stream($fh); // create a stream instance for the response body
......@@ -1021,6 +1024,7 @@ group by b.mon order by b.mon asc');
->withHeader('Content-Type', 'application/octet-stream')
->withHeader('Content-Description', 'File Transfer')
->withHeader('Content-Transfer-Encoding', 'binary')
->withHeader('Content-Length', $size)
->withHeader('Content-Disposition', 'attachment; filename="' . $v['dbp_str_id'].'-'.$v['version'].'.dbp' . '"')
->withHeader('Expires', '0')
->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment