Fix error handling
This commit is contained in:
parent
0e1d84733e
commit
535d869ddc
1 changed files with 2 additions and 2 deletions
|
@ -100,8 +100,8 @@ class Attachment(models.Model):
|
|||
)
|
||||
|
||||
res = response.json()
|
||||
if len(res) == 0:
|
||||
logger.error("Shortpixel response is empty: %s", res)
|
||||
if len(res) == 0 or not isinstance(res, list):
|
||||
logger.error("Shortpixel response is not a non-empty list: %s", res)
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
res_data = res[0]
|
||||
|
|
Reference in a new issue