diff --git a/authentik/stages/email/models.py b/authentik/stages/email/models.py index 9c96a8906..0908a0010 100644 --- a/authentik/stages/email/models.py +++ b/authentik/stages/email/models.py @@ -37,7 +37,7 @@ def get_template_choices(): dirs = [Path(x) for x in settings.TEMPLATES[0]["DIRS"]] for template_dir in dirs: - if not template_dir.exists(): + if not template_dir.exists() or not template_dir.is_dir(): continue for template in template_dir.glob("**/*.html"): path = str(template) diff --git a/authentik/stages/email/tests/test_templates.py b/authentik/stages/email/tests/test_templates.py index 01f6d9213..a60266a65 100644 --- a/authentik/stages/email/tests/test_templates.py +++ b/authentik/stages/email/tests/test_templates.py @@ -13,7 +13,7 @@ from authentik.stages.email.models import get_template_choices def get_templates_setting(temp_dir: str) -> dict[str, Any]: """Patch settings TEMPLATE's dir property""" templates_setting = settings.TEMPLATES - templates_setting[0]["DIRS"] = [temp_dir] + templates_setting[0]["DIRS"] = [temp_dir, "foo"] return templates_setting