Better handle large downloads on backup API
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
aef45a90b2
commit
9847934de9
1 changed files with 2 additions and 1 deletions
|
@ -249,6 +249,7 @@ class SettingsController extends Controller
|
||||||
'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])),
|
'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])),
|
||||||
'modified_value' => $file_timestamp,
|
'modified_value' => $file_timestamp,
|
||||||
'modified_display' => date($settings->date_display_format.' '.$settings->time_display_format, $file_timestamp),
|
'modified_display' => date($settings->date_display_format.' '.$settings->time_display_format, $file_timestamp),
|
||||||
|
'backup_url' => config('app.url').'/settings/backups/download/'.basename($backup_files[$f]),
|
||||||
|
|
||||||
];
|
];
|
||||||
$count++;
|
$count++;
|
||||||
|
@ -269,7 +270,7 @@ class SettingsController extends Controller
|
||||||
$path = 'app/backups';
|
$path = 'app/backups';
|
||||||
if (Storage::exists($path.'/'.$file)) {
|
if (Storage::exists($path.'/'.$file)) {
|
||||||
$headers = ['ContentType' => 'application/zip'];
|
$headers = ['ContentType' => 'application/zip'];
|
||||||
return Storage::download($path.'/'.$file, $file, $headers);
|
return response()->download($path.'/'.$file, $file, $headers);
|
||||||
} else {
|
} else {
|
||||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found')));
|
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found')));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue