mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Only display the file if the log record can be found
This commit is contained in:
parent
56576d9e45
commit
6dcdb5abae
|
@ -585,9 +585,10 @@ class LicensesController extends Controller
|
|||
if (isset($license->id)) {
|
||||
$this->authorize('view', $license);
|
||||
$log = Actionlog::find($fileId);
|
||||
|
||||
if ($log) {
|
||||
|
||||
$file = $log->get_src('licenses');
|
||||
|
||||
|
||||
if ($file =='') {
|
||||
return response('File not found on server', 404)
|
||||
->header('Content-Type', 'text/plain');
|
||||
|
@ -595,7 +596,6 @@ class LicensesController extends Controller
|
|||
|
||||
$mimetype = \File::mimeType($file);
|
||||
|
||||
|
||||
if (!file_exists($file)) {
|
||||
return response('File '.$file.' not found on server', 404)
|
||||
->header('Content-Type', 'text/plain');
|
||||
|
@ -610,6 +610,8 @@ class LicensesController extends Controller
|
|||
return Response::download($file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue