mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Catch error when generating company thumbnail images
This commit is contained in:
parent
5f19f534fc
commit
47a1143570
@ -7,6 +7,7 @@ from django.apps import AppConfig
|
|||||||
from django.db.utils import OperationalError, ProgrammingError
|
from django.db.utils import OperationalError, ProgrammingError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
from PIL import UnidentifiedImageError
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -38,9 +39,11 @@ class CompanyConfig(AppConfig):
|
|||||||
try:
|
try:
|
||||||
company.image.render_variations(replace=False)
|
company.image.render_variations(replace=False)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
logger.warning("Image file missing")
|
logger.warning(f"Image file '{company.image}' missing")
|
||||||
company.image = None
|
company.image = None
|
||||||
company.save()
|
company.save()
|
||||||
|
except UnidentifiedImageError:
|
||||||
|
logger.warning(f"Image file '{company.image}' is invalid")
|
||||||
except (OperationalError, ProgrammingError):
|
except (OperationalError, ProgrammingError):
|
||||||
# Getting here probably meant the database was in test mode
|
# Getting here probably meant the database was in test mode
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user