mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-25 20:51:30 -08:00
Return 404 if download file isn’t found
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
cae2de4fc9
commit
c76fbe4edb
|
@ -267,12 +267,13 @@ class SettingsController extends Controller
|
||||||
|
|
||||||
public function downloadBackup($file) {
|
public function downloadBackup($file) {
|
||||||
|
|
||||||
$path = 'app/backups';
|
$path = storage_path('app/backups');
|
||||||
if (Storage::exists($path.'/'.$file)) {
|
|
||||||
|
if (Storage::exists('app/backups/'.$file)) {
|
||||||
$headers = ['ContentType' => 'application/zip'];
|
$headers = ['ContentType' => 'application/zip'];
|
||||||
return response()->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')), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue