From 27f172fe8749553b5ee59f7b44c2d6a0eef7219c Mon Sep 17 00:00:00 2001 From: Fabien Amelinck Date: Tue, 17 Mar 2026 14:59:25 +0100 Subject: [PATCH 1/3] fix(portal): wrong media-type for base64 encoded images --- CHANGELOG | 2 ++ vulture_os/authentication/portal_template/models.py | 4 ++-- vulture_os/portal/system/authentications.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5f5c2a0f1..147237cc7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- [PORTAL] [TEMPLATE] Wrong media-type for base64 encoded images ## [2.35.1] - 2026-03-06 diff --git a/vulture_os/authentication/portal_template/models.py b/vulture_os/authentication/portal_template/models.py index cc54caba3..ce6de3c3d 100644 --- a/vulture_os/authentication/portal_template/models.py +++ b/vulture_os/authentication/portal_template/models.py @@ -429,7 +429,7 @@ def get_as_html(self): :return: A string with pre-formatted html for the image """ - return "".format(self.image_type, self.content) + return f"" def create_preview_html(self): """ @@ -437,4 +437,4 @@ def create_preview_html(self): :return: A string with pre-formatted html for the image """ - return "data:image/{};base64,{}".format(self.image_type, self.content) + return f"data:{self.image_type};base64,{self.content}" diff --git a/vulture_os/portal/system/authentications.py b/vulture_os/portal/system/authentications.py index 9b5a3c2ca..bf28d0b74 100644 --- a/vulture_os/portal/system/authentications.py +++ b/vulture_os/portal/system/authentications.py @@ -341,7 +341,7 @@ def authenticate(self, request): def ask_credentials_response(self, **kwargs): if self.workflow.authentication.enable_captcha: captcha_key = self.redis_portal_session.register_captcha(self.workflow.id) - captcha = "data:image/image/png;base64," + b64encode(ImageCaptcha().generate(captcha_key).read()).decode() + captcha = "data:image/png;base64," + b64encode(ImageCaptcha().generate(captcha_key).read()).decode() else: captcha = False From 54c84ac843df4a4ba56e7171f54789529d638bb5 Mon Sep 17 00:00:00 2001 From: Fabien Amelinck Date: Tue, 17 Mar 2026 17:09:39 +0100 Subject: [PATCH 2/3] doc(CHANGELOG): Version 2.35.2 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 147237cc7..5663e9c51 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] + + +## [2.35.2] - 2026-03-17 ### Fixed - [PORTAL] [TEMPLATE] Wrong media-type for base64 encoded images From 0e0d69a168c1fa0bb14745e9233a5e14b00771f5 Mon Sep 17 00:00:00 2001 From: Fabien Amelinck Date: Wed, 18 Mar 2026 09:51:55 +0100 Subject: [PATCH 3/3] clean(ruff): resolve ruff warnings --- vulture_os/authentication/portal_template/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vulture_os/authentication/portal_template/models.py b/vulture_os/authentication/portal_template/models.py index ce6de3c3d..7ceeabc1a 100644 --- a/vulture_os/authentication/portal_template/models.py +++ b/vulture_os/authentication/portal_template/models.py @@ -417,8 +417,8 @@ def get_image_uri(self): :return: String containing the URI of the image. """ try: - url = 'portal_statics/{}'.format(self.uid) - except: + url = f"portal_statics/{self.uid}" + except Exception: return None return url