Only display the file if the log record can be found

This commit is contained in:
snipe 2019-05-24 16:06:52 -07:00
parent 56576d9e45
commit 6dcdb5abae

View file

@ -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')));
}