Check that the $use_db_field has a value before attempting a delete

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-01-13 11:26:11 -08:00
parent 4f8951f6f1
commit 9d0a15990e

View file

@ -146,7 +146,7 @@ class ImageUploadRequest extends Request
}
// Remove Current image if exists
if (Storage::disk('public')->exists($path.'/'.$item->{$use_db_field})) {
if (($item->{$use_db_field}!='') && (Storage::disk('public')->exists($path.'/'.$item->{$use_db_field}))) {
\Log::debug('A file already exists that we are replacing - we should delete the old one.');
try {
Storage::disk('public')->delete($path.'/'.$item->{$use_db_field});