mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 08:28:42 +00:00
early return
This commit is contained in:
parent
bad74bd0b8
commit
9f07a2bca4
1 changed files with 7 additions and 6 deletions
|
|
@ -102,12 +102,6 @@ class Get extends Action
|
|||
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$response
|
||||
->setContentType('application/gzip')
|
||||
->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days
|
||||
->addHeader('X-Peak', \memory_get_peak_usage())
|
||||
->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '-' . $type . '.tar.gz"');
|
||||
|
||||
$size = $device->getFileSize($path);
|
||||
$rangeHeader = $request->getHeader('range');
|
||||
|
||||
|
|
@ -131,8 +125,15 @@ class Get extends Action
|
|||
->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT);
|
||||
|
||||
$response->send($device->read($path, $start, ($end - $start + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
$response
|
||||
->setContentType('application/gzip')
|
||||
->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days
|
||||
->addHeader('X-Peak', \memory_get_peak_usage())
|
||||
->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '-' . $type . '.tar.gz"');
|
||||
|
||||
if ($size > APP_STORAGE_READ_BUFFER) {
|
||||
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
|
||||
$response->chunk(
|
||||
|
|
|
|||
Loading…
Reference in a new issue