mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-12 16:44:08 -08:00
Merge pull request #12679 from snipe/bug/sc-20451
Handle already-deleted license files more gracefully
This commit is contained in:
commit
b64d7e38f2
|
@ -91,12 +91,11 @@ class LicenseFilesController extends Controller
|
||||||
*/
|
*/
|
||||||
public function destroy($licenseId = null, $fileId = null)
|
public function destroy($licenseId = null, $fileId = null)
|
||||||
{
|
{
|
||||||
$license = License::find($licenseId);
|
if ($license = License::find($licenseId)) {
|
||||||
|
|
||||||
// the asset is valid
|
|
||||||
if (isset($license->id)) {
|
|
||||||
$this->authorize('update', $license);
|
$this->authorize('update', $license);
|
||||||
$log = Actionlog::find($fileId);
|
|
||||||
|
if ($log = Actionlog::find($fileId)) {
|
||||||
|
|
||||||
// Remove the file if one exists
|
// Remove the file if one exists
|
||||||
if (Storage::exists('licenses/'.$log->filename)) {
|
if (Storage::exists('licenses/'.$log->filename)) {
|
||||||
|
@ -113,7 +112,9 @@ class LicenseFilesController extends Controller
|
||||||
->with('success', trans('admin/hardware/message.deletefile.success'));
|
->with('success', trans('admin/hardware/message.deletefile.success'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to the licence management page
|
return redirect()->route('licenses.index')->with('error', trans('general.log_does_not_exist'));
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
|
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +130,6 @@ class LicenseFilesController extends Controller
|
||||||
*/
|
*/
|
||||||
public function show($licenseId = null, $fileId = null, $download = true)
|
public function show($licenseId = null, $fileId = null, $download = true)
|
||||||
{
|
{
|
||||||
\Log::info('Private filesystem is: '.config('filesystems.default'));
|
|
||||||
$license = License::find($licenseId);
|
$license = License::find($licenseId);
|
||||||
|
|
||||||
// the license is valid
|
// the license is valid
|
||||||
|
|
|
@ -407,7 +407,7 @@ return [
|
||||||
'true' => 'True',
|
'true' => 'True',
|
||||||
'false' => 'False',
|
'false' => 'False',
|
||||||
'integration_option' => 'Integration Option',
|
'integration_option' => 'Integration Option',
|
||||||
|
'log_does_not_exist' => 'No matching log record exists.',
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
Loading…
Reference in a new issue