Don't try to delete the file if there is no log entry

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-09-22 19:04:25 -07:00
parent 3821c4d372
commit a6b3aa5f04

View file

@ -117,13 +117,13 @@ class AssetFilesController extends Controller
$this->authorize('update', $asset);
$log = Actionlog::find($fileId);
if ($log) {
if (Storage::exists($rel_path.'/'.$log->filename)) {
Storage::delete($rel_path.'/'.$log->filename);
if (Storage::exists($rel_path.'/'.$log->filename)) {
Storage::delete($rel_path.'/'.$log->filename);
}
$log->delete();
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
}
$log->delete();
return redirect()->back()
->with('success', trans('admin/hardware/message.deletefile.success'));
}