Skip to content

Commit

Permalink
Fixed an error when deleting a record
Browse files Browse the repository at this point in the history
Fixed an error when deleting a record if the icon field is null

TypeError: App\Models\User::deleteImage(): Argument #1 ($filePath) must be of type string, null given, called in /var/www/html/vendor/qcod/laravel-imageup/src/HasImageUploads.php on line 800 and defined in /var/www/html/vendor/qcod/laravel-imageup/src/HasImageUploads.php:64
  • Loading branch information
dmitriymikheev authored May 10, 2022
1 parent da1bb0b commit 63df868
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/HasImageUploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,9 @@ protected function autoDeleteImage(): void
if (config('imageup.auto_delete_images')) {
foreach ($this->getDefinedUploadFields() as $field => $options) {
$field = is_numeric($field) ? $options : $field;
$this->deleteImage($this->getOriginal($field));
if (!is_null($this->getOriginal($field))) {
$this->deleteImage($this->getOriginal($field));
}
}
}
}
Expand Down

0 comments on commit 63df868

Please sign in to comment.