diff --git a/InvenTree/company/apps.py b/InvenTree/company/apps.py index 2777425ab4..3fa3197183 100644 --- a/InvenTree/company/apps.py +++ b/InvenTree/company/apps.py @@ -7,6 +7,7 @@ from django.apps import AppConfig from django.db.utils import OperationalError, ProgrammingError from django.conf import settings +from PIL import UnidentifiedImageError logger = logging.getLogger(__name__) @@ -38,9 +39,11 @@ class CompanyConfig(AppConfig): try: company.image.render_variations(replace=False) except FileNotFoundError: - logger.warning("Image file missing") + logger.warning(f"Image file '{company.image}' missing") company.image = None company.save() + except UnidentifiedImageError: + logger.warning(f"Image file '{company.image}' is invalid") except (OperationalError, ProgrammingError): # Getting here probably meant the database was in test mode pass