mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Merge pull request #14296 from snipe/fixes/return_download_for_backup_api
Better handle large downloads on backup API
This commit is contained in:
commit
7c346d977a
|
@ -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…
Reference in a new issue