From 263d9128c48e50fe5e8cc09f255f2e2a3f17082e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 26 Oct 2023 16:06:00 +0200 Subject: [PATCH] stages/email: fix path for email icon Signed-off-by: Jens Langhammer --- authentik/stages/email/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/authentik/stages/email/utils.py b/authentik/stages/email/utils.py index 5422ec43a..5b2637662 100644 --- a/authentik/stages/email/utils.py +++ b/authentik/stages/email/utils.py @@ -1,6 +1,7 @@ """email utils""" from email.mime.image import MIMEImage from functools import lru_cache +from pathlib import Path from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string @@ -10,7 +11,10 @@ from django.utils import translation @lru_cache() def logo_data(): """Get logo as MIME Image for emails""" - with open("web/icons/icon_left_brand.png", "rb") as _logo_file: + path = Path("web/icons/icon_left_brand.png") + if not path.exists(): + path = Path("web/dist/assets/icons/icon_left_brand.png") + with open(path, "rb") as _logo_file: logo = MIMEImage(_logo_file.read()) logo.add_header("Content-ID", "logo.png") return logo