mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Only build the log upload destination path if there is a matching record
Fixes [ch1232]
This commit is contained in:
parent
1472e9d5b5
commit
78fb2b2239
|
@ -111,12 +111,16 @@ class AssetFilesController extends Controller
|
||||||
$this->authorize('update', $asset);
|
$this->authorize('update', $asset);
|
||||||
|
|
||||||
$log = Actionlog::find($fileId);
|
$log = Actionlog::find($fileId);
|
||||||
$full_filename = $destinationPath.'/'.$log->filename;
|
if ($log) {
|
||||||
if (file_exists($full_filename)) {
|
$full_filename = $destinationPath.'/'.$log->filename;
|
||||||
unlink($destinationPath.'/'.$log->filename);
|
if (file_exists($full_filename)) {
|
||||||
|
unlink($destinationPath.'/'.$log->filename);
|
||||||
|
}
|
||||||
|
$log->delete();
|
||||||
|
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
|
||||||
}
|
}
|
||||||
$log->delete();
|
return redirect()->back()->with('error', 'Could not find matching upload log.');
|
||||||
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to the hardware management page
|
// Redirect to the hardware management page
|
||||||
|
|
Loading…
Reference in a new issue