mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-31 16:37:27 -08:00
Improve check for image existence
This commit is contained in:
parent
51a0767be9
commit
54f5f46e31
|
@ -193,7 +193,7 @@ class ComponentsController extends Controller
|
||||||
$this->authorize('delete', $component);
|
$this->authorize('delete', $component);
|
||||||
|
|
||||||
// Remove the image if one exists
|
// Remove the image if one exists
|
||||||
if (Storage::disk('public')->exists('components/'.$component->image)) {
|
if ($component->image && Storage::disk('public')->exists('components/' . $component->image)) {
|
||||||
try {
|
try {
|
||||||
Storage::disk('public')->delete('components/'.$component->image);
|
Storage::disk('public')->delete('components/'.$component->image);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
Loading…
Reference in a new issue