diff --git a/src/backend/InvenTree/InvenTree/api.py b/src/backend/InvenTree/InvenTree/api.py index 1dfc53fa5c..ae4123d76c 100644 --- a/src/backend/InvenTree/InvenTree/api.py +++ b/src/backend/InvenTree/InvenTree/api.py @@ -307,7 +307,7 @@ class InfoView(APIView): 'docker_mode': settings.DOCKER, 'default_locale': settings.LANGUAGE_CODE, 'customize': { - 'logo': helpers.getLogoImage(), + 'logo': helpers.getLogoImage(backup=False), 'splash': helpers.getSplashScreen(), 'login_message': helpers.getCustomOption('login_message'), 'navbar_message': helpers.getCustomOption('navbar_message'), diff --git a/src/backend/InvenTree/InvenTree/helpers.py b/src/backend/InvenTree/InvenTree/helpers.py index 7b7cef24d5..c2f5be1c8a 100644 --- a/src/backend/InvenTree/InvenTree/helpers.py +++ b/src/backend/InvenTree/InvenTree/helpers.py @@ -262,8 +262,14 @@ def checkStaticFile(*args) -> bool: return static_storage.exists(str(fn)) -def getLogoImage(as_file=False, custom=True): - """Return the InvenTree logo image, or a custom logo if available.""" +def getLogoImage(as_file: bool = False, custom: bool = True, backup: bool = True): + """Return the InvenTree logo image, or a custom logo if available. + + Arguments: + as_file: Return a file path instead of a URL (default = False) + custom: Use a custom logo if available (default = True) + backup: Use a backup logo if available (default = True) + """ if custom and settings.CUSTOM_LOGO: static_storage = StaticFilesStorage() @@ -279,11 +285,14 @@ def getLogoImage(as_file=False, custom=True): return f'file://{storage.path(settings.CUSTOM_LOGO)}' return storage.url(settings.CUSTOM_LOGO) - # If we have got to this point, return the default logo - if as_file: - path = settings.STATIC_ROOT.joinpath('img/inventree.png') - return f'file://{path}' - return getStaticUrl('img/inventree.png') + # If we have got to this point, return the default logo (if requested) + if backup: + if as_file: + path = settings.STATIC_ROOT.joinpath('img/inventree.png') + return f'file://{path}' + return getStaticUrl('img/inventree.png') + + return None def getSplashScreen(custom=True):